forked from hyperledger/fabric-chaincode-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMyAsset.java
More file actions
39 lines (30 loc) · 832 Bytes
/
MyAsset.java
File metadata and controls
39 lines (30 loc) · 832 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
* SPDX-License-Identifier: Apache-2.0
*/
package org.example;
import org.hyperledger.fabric.contract.annotation.Contract;
import org.hyperledger.fabric.contract.annotation.DataType;
import org.hyperledger.fabric.contract.annotation.Property;
import org.json.JSONObject;
@DataType()
public class MyAsset {
@Property()
private String value;
public MyAsset(){
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public String toJSONString() {
return new JSONObject(this).toString();
}
public static MyAsset fromJSONString(String json) {
String value = new JSONObject(json).getString("value");
MyAsset asset = new MyAsset();
asset.setValue(value);
return asset;
}
}