Skip to content

Commit ad582f1

Browse files
author
Hubert MARTEAU
committed
2.0.2
1 parent b601a61 commit ad582f1

File tree

12 files changed

+265
-11
lines changed

12 files changed

+265
-11
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
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+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
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.JsonObject;
11+
import com.google.gson.internal.LinkedTreeMap;
12+
import multichain.object.formatters.GenericOutputFormatter;
13+
14+
/**
15+
* @author Ub - H. MARTEAU
16+
* @version 2.0.2
17+
*/
18+
public class StreamDataCache extends StreamData {
19+
private String cache;
20+
21+
/**
22+
*
23+
*/
24+
public StreamDataCache() {
25+
super();
26+
}
27+
28+
/**
29+
* @param text
30+
*/
31+
public StreamDataCache(String cache) {
32+
super();
33+
this.cache = cache;
34+
}
35+
36+
/**
37+
* @param jsonObject
38+
*/
39+
public StreamDataCache(LinkedTreeMap<?, ?> jsonObject) {
40+
this(((StreamDataCache) GenericOutputFormatter.format(jsonObject, StreamDataCache.class))
41+
.getCache());
42+
}
43+
44+
/**
45+
* @param jsonObject
46+
*/
47+
public StreamDataCache(Object jsonObject) {
48+
this(((StreamDataCache) GenericOutputFormatter.format((LinkedTreeMap<?, ?>) jsonObject,
49+
StreamDataCache.class)).getCache());
50+
}
51+
52+
53+
@Override
54+
public JsonObject getPublicationValue() {
55+
return getJsonValue(this);
56+
}
57+
58+
/**
59+
* @return the cache
60+
*/
61+
public String getCache() {
62+
return cache;
63+
}
64+
65+
/**
66+
* @param cache the cache to set
67+
*/
68+
public void setCache(String cache) {
69+
this.cache = cache;
70+
}
71+
72+
}

0 commit comments

Comments
 (0)