Coverage Summary for Class: CompilationResult (org.ethereum.solidity.compiler)
Class |
Method, %
|
Line, %
|
CompilationResult |
0%
(0/2)
|
0%
(0/7)
|
CompilationResult$ContractMetadata |
0%
(0/3)
|
0%
(0/3)
|
Total |
0%
(0/5)
|
0%
(0/10)
|
1 /*
2 * This file is part of RskJ
3 * Copyright (C) 2017 RSK Labs Ltd.
4 * (derived from ethereumJ library, Copyright (c) 2016 <ether.camp>)
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 package org.ethereum.solidity.compiler;
21
22 import com.fasterxml.jackson.databind.ObjectMapper;
23 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
24
25 import java.io.IOException;
26 import java.util.Collections;
27 import java.util.Map;
28
29 @JsonIgnoreProperties(ignoreUnknown = true)
30 public class CompilationResult {
31
32 public Map<String, ContractMetadata> contracts;
33 public String version;
34
35 public static CompilationResult parse(String rawJson) throws IOException {
36 if(rawJson == null || rawJson.isEmpty()){
37 CompilationResult empty = new CompilationResult();
38 empty.contracts = Collections.emptyMap();
39 empty.version = "";
40
41 return empty;
42 } else {
43 return new ObjectMapper().readValue(rawJson, CompilationResult.class);
44 }
45 }
46
47 @JsonIgnoreProperties(ignoreUnknown = true)
48 public static class ContractMetadata {
49 public String abi;
50 public String bin;
51 public String solInterface;
52
53 public String getInterface() {
54 return solInterface;
55 }
56
57 public void setInterface(String solInterface) {
58 this.solInterface = solInterface;
59 }
60 }
61 }