Skip to content

Commit fc9d5d8

Browse files
authored
Merge pull request #1 from SimplyUb/master
pull new changes
2 parents 7bc1f0f + b12390d commit fc9d5d8

File tree

15 files changed

+454
-185
lines changed

15 files changed

+454
-185
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.multichainjavaapi</groupId>
55
<artifactId>MultiChainJavaAPI</artifactId>
6-
<version>2.0.1-SNAPSHOT</version>
6+
<version>2.0.2-SNAPSHOT</version>
77

88
<properties>
99
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

src/main/java/multichain/command/CommandElt.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public enum CommandElt {
124124
GETNETWORKHASHPS("getnetworkhashps", null, new Class<?>[] {Long.class}),
125125
GETNETWORKINFO("getnetworkinfo", null, new Class<?>[] {NetworkInfo.class}),
126126
GETNEWADDRESS("getnewaddress", null, new Class<?>[] {String.class}),
127-
GETPEERINFO("getpeerinfo", null, new Class<?>[]{PeerInfo.class}, true),
127+
GETPEERINFO("getpeerinfo", null, new Class<?>[] {PeerInfo.class}),
128128
GETRAWCHANGEADDRESS("getrawchangeaddress", null, new Class<?>[] {String.class}),
129129
GETRAWMEMPOOL("getrawmempool", null,
130130
new Class<?>[] {String.class, (new HashMap<String, RawMemPoolTransaction>()).getClass()},

src/main/java/multichain/command/CommandManager.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ public Object invokeWithControl(CommandElt command, Object... parameters)
5151
throws MultichainException {
5252

5353
// Input Management
54-
Object commandParameters = command.getCommandParameters();
54+
@SuppressWarnings("unused")
55+
Object commandParameters = command.getCommandParameters();
5556
boolean controlValue = true; // Will be done in 6.02
5657

5758
if (controlValue) {

src/main/java/multichain/object/MultichainStreamItemJsonValueObject.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* @author mengl
55
*/
66
public class MultichainStreamItemJsonValueObject {
7-
private Object json;
7+
@SuppressWarnings("unused")
8+
private Object json;
89

910
public MultichainStreamItemJsonValueObject(Object json) {
1011
this.json = json;

src/main/java/multichain/object/MultichainStreamItemTextValueObject.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
* @author mengl
55
*/
66
public class MultichainStreamItemTextValueObject {
7-
private String text;
7+
@SuppressWarnings("unused")
8+
private String text;
89

910
public MultichainStreamItemTextValueObject(String text) {
1011
this.text = text;

src/main/java/multichain/object/StreamKeyInfo.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
/**
1313
* @author Ub - H. MARTEAU
14-
* @version 2.0.1
14+
* @version 2.0.2
1515
*/
1616
public class StreamKeyInfo {
1717
List<String> publishers;
1818
String key = null;
19-
String data = null;
19+
Object data = null;
2020
Long confirmations = null;
2121
String blockhash = null;
2222
Long blockindex = null;
@@ -71,14 +71,14 @@ public void setKey(String key) {
7171
/**
7272
* @return the data
7373
*/
74-
public String getData() {
74+
public Object getData() {
7575
return data;
7676
}
7777

7878
/**
7979
* @param data the data to set
8080
*/
81-
public void setData(String data) {
81+
public void setData(Object data) {
8282
this.data = data;
8383
}
8484

src/main/java/multichain/object/StreamKeyItem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
/**
1313
* @author Ub - H. MARTEAU
14-
* @version 2.0.1
14+
* @version 2.0.2
1515
*/
1616
public class StreamKeyItem {
1717
List<String> publishers;

src/main/java/multichain/object/formatters/GenericOutputFormatter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public static final Object format(Object jsonValue, Class<?>[] valueTypes) {
4545
}
4646

4747

48-
private static final <T> T format(Object jsonValue, Class<T> valueType) {
48+
public static final <T> T format(Object jsonValue, Class<T> valueType) {
4949
T returnedValue = null;
5050

5151
if (jsonValue != null

src/main/java/multichain/object/queryobjects/AssetParams.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,28 @@
99

1010
/**
1111
* @author Ub - H. MARTEAU
12-
* @version 2.0.1
12+
* @version 2.0.2
1313
*/
1414
public class AssetParams {
1515
String name;
1616
boolean open;
17-
String restrict;
17+
String restrict = null;
1818

1919
/**
2020
* @param name
2121
* @param open
2222
*/
23+
public AssetParams(String name, boolean open) {
24+
super();
25+
this.name = name;
26+
this.open = open;
27+
}
28+
29+
/**
30+
* @param name
31+
* @param open
32+
* @param restrict
33+
*/
2334
public AssetParams(String name, boolean open, String restrict) {
2435
super();
2536
this.name = name;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright (C) 2017 Worldline, Inc.
3+
*
4+
* MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file.
5+
* https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE
6+
*
7+
*/
8+
package multichain.object.queryobjects;
9+
10+
import com.google.gson.Gson;
11+
import com.google.gson.GsonBuilder;
12+
import com.google.gson.JsonElement;
13+
import com.google.gson.JsonObject;
14+
15+
/**
16+
* @author Ub - H. MARTEAU
17+
* @version 2.0.2
18+
*/
19+
public abstract class StreamData {
20+
public abstract JsonObject getPublicationValue();
21+
22+
protected JsonObject getJsonValue(Object object) {
23+
final GsonBuilder builder = new GsonBuilder();
24+
final Gson gson = builder.create();
25+
26+
JsonElement jsonElement = gson.toJsonTree(object);
27+
JsonObject jsonObject = (JsonObject) jsonElement;
28+
// property removal
29+
jsonObject.remove("property");
30+
31+
return jsonObject;
32+
}
33+
34+
35+
}

0 commit comments

Comments
 (0)