Skip to content

pull new changes #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.multichainjavaapi</groupId>
<artifactId>MultiChainJavaAPI</artifactId>
<version>2.0.1-SNAPSHOT</version>
<version>2.0.2-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/multichain/command/CommandElt.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public enum CommandElt {
GETNETWORKHASHPS("getnetworkhashps", null, new Class<?>[] {Long.class}),
GETNETWORKINFO("getnetworkinfo", null, new Class<?>[] {NetworkInfo.class}),
GETNEWADDRESS("getnewaddress", null, new Class<?>[] {String.class}),
GETPEERINFO("getpeerinfo", null, new Class<?>[]{PeerInfo.class}, true),
GETPEERINFO("getpeerinfo", null, new Class<?>[] {PeerInfo.class}),
GETRAWCHANGEADDRESS("getrawchangeaddress", null, new Class<?>[] {String.class}),
GETRAWMEMPOOL("getrawmempool", null,
new Class<?>[] {String.class, (new HashMap<String, RawMemPoolTransaction>()).getClass()},
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/multichain/command/CommandManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ public Object invokeWithControl(CommandElt command, Object... parameters)
throws MultichainException {

// Input Management
Object commandParameters = command.getCommandParameters();
@SuppressWarnings("unused")
Object commandParameters = command.getCommandParameters();
boolean controlValue = true; // Will be done in 6.02

if (controlValue) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* @author mengl
*/
public class MultichainStreamItemJsonValueObject {
private Object json;
@SuppressWarnings("unused")
private Object json;

public MultichainStreamItemJsonValueObject(Object json) {
this.json = json;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
* @author mengl
*/
public class MultichainStreamItemTextValueObject {
private String text;
@SuppressWarnings("unused")
private String text;

public MultichainStreamItemTextValueObject(String text) {
this.text = text;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/multichain/object/StreamKeyInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

/**
* @author Ub - H. MARTEAU
* @version 2.0.1
* @version 2.0.2
*/
public class StreamKeyInfo {
List<String> publishers;
String key = null;
String data = null;
Object data = null;
Long confirmations = null;
String blockhash = null;
Long blockindex = null;
Expand Down Expand Up @@ -71,14 +71,14 @@ public void setKey(String key) {
/**
* @return the data
*/
public String getData() {
public Object getData() {
return data;
}

/**
* @param data the data to set
*/
public void setData(String data) {
public void setData(Object data) {
this.data = data;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/multichain/object/StreamKeyItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

/**
* @author Ub - H. MARTEAU
* @version 2.0.1
* @version 2.0.2
*/
public class StreamKeyItem {
List<String> publishers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public static final Object format(Object jsonValue, Class<?>[] valueTypes) {
}


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

if (jsonValue != null
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/multichain/object/queryobjects/AssetParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,28 @@

/**
* @author Ub - H. MARTEAU
* @version 2.0.1
* @version 2.0.2
*/
public class AssetParams {
String name;
boolean open;
String restrict;
String restrict = null;

/**
* @param name
* @param open
*/
public AssetParams(String name, boolean open) {
super();
this.name = name;
this.open = open;
}

/**
* @param name
* @param open
* @param restrict
*/
public AssetParams(String name, boolean open, String restrict) {
super();
this.name = name;
Expand Down
35 changes: 35 additions & 0 deletions src/main/java/multichain/object/queryobjects/StreamData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2017 Worldline, Inc.
*
* MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file.
* https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE
*
*/
package multichain.object.queryobjects;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;

/**
* @author Ub - H. MARTEAU
* @version 2.0.2
*/
public abstract class StreamData {
public abstract JsonObject getPublicationValue();

protected JsonObject getJsonValue(Object object) {
final GsonBuilder builder = new GsonBuilder();
final Gson gson = builder.create();

JsonElement jsonElement = gson.toJsonTree(object);
JsonObject jsonObject = (JsonObject) jsonElement;
// property removal
jsonObject.remove("property");

return jsonObject;
}


}
72 changes: 72 additions & 0 deletions src/main/java/multichain/object/queryobjects/StreamDataCache.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* Copyright (C) 2017 Worldline, Inc.
*
* MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file.
* https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE
*
*/
package multichain.object.queryobjects;

import com.google.gson.JsonObject;
import com.google.gson.internal.LinkedTreeMap;
import multichain.object.formatters.GenericOutputFormatter;

/**
* @author Ub - H. MARTEAU
* @version 2.0.2
*/
public class StreamDataCache extends StreamData {
private String cache;

/**
*
*/
public StreamDataCache() {
super();
}

/**
* @param text
*/
public StreamDataCache(String cache) {
super();
this.cache = cache;
}

/**
* @param jsonObject
*/
public StreamDataCache(LinkedTreeMap<?, ?> jsonObject) {
this(((StreamDataCache) GenericOutputFormatter.format(jsonObject, StreamDataCache.class))
.getCache());
}

/**
* @param jsonObject
*/
public StreamDataCache(Object jsonObject) {
this(((StreamDataCache) GenericOutputFormatter.format((LinkedTreeMap<?, ?>) jsonObject,
StreamDataCache.class)).getCache());
}


@Override
public JsonObject getPublicationValue() {
return getJsonValue(this);
}

/**
* @return the cache
*/
public String getCache() {
return cache;
}

/**
* @param cache the cache to set
*/
public void setCache(String cache) {
this.cache = cache;
}

}
73 changes: 73 additions & 0 deletions src/main/java/multichain/object/queryobjects/StreamDataJson.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* Copyright (C) 2017 Worldline, Inc.
*
* MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file.
* https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE
*
*/
package multichain.object.queryobjects;

import com.google.gson.JsonObject;
import com.google.gson.internal.LinkedTreeMap;
import multichain.object.formatters.GenericOutputFormatter;

/**
* @author Ub - H. MARTEAU
* @version 2.0.2
*/
public class StreamDataJson extends StreamData {
private JsonObject json;

/**
*
*/
public StreamDataJson() {
super();
}

/**
* @param json
*/
public StreamDataJson(JsonObject json) {
super();
this.json = json;
}

/**
* @param jsonObject
*/
public StreamDataJson(LinkedTreeMap<?, ?> jsonObject) {
this(((StreamDataJson) GenericOutputFormatter.format(jsonObject, StreamDataJson.class))
.getJson());
}

/**
* @param jsonObject
*/
public StreamDataJson(Object jsonObject) {
this(((StreamDataJson) GenericOutputFormatter.format((LinkedTreeMap<?, ?>) jsonObject,
StreamDataJson.class)).getJson());
}



@Override
public JsonObject getPublicationValue() {
return getJsonValue(this);
}

/**
* @return the json
*/
public JsonObject getJson() {
return json;
}

/**
* @param json the json to set
*/
public void setJson(JsonObject json) {
this.json = json;
}

}
71 changes: 71 additions & 0 deletions src/main/java/multichain/object/queryobjects/StreamDataText.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* Copyright (C) 2017 Worldline, Inc.
*
* MultiChainJavaAPI code distributed under the GPLv3 license, see COPYING file.
* https://github.com/SimplyUb/MultiChainJavaAPI/blob/master/LICENSE
*
*/
package multichain.object.queryobjects;

import com.google.gson.JsonObject;
import com.google.gson.internal.LinkedTreeMap;
import multichain.object.formatters.GenericOutputFormatter;

/**
* @author Ub - H. MARTEAU
* @version 2.0.2
*/
public class StreamDataText extends StreamData {
private String text;

/**
*
*/
public StreamDataText() {
super();
}

/**
* @param text
*/
public StreamDataText(String text) {
super();
this.text = text;
}

/**
* @param jsonObject
*/
public StreamDataText(LinkedTreeMap<?, ?> jsonObject) {
this(((StreamDataText) GenericOutputFormatter.format(jsonObject, StreamDataText.class))
.getText());
}

/**
* @param jsonObject
*/
public StreamDataText(Object jsonObject) {
this(((StreamDataText) GenericOutputFormatter.format((LinkedTreeMap<?, ?>) jsonObject,
StreamDataText.class)).getText());
}

/**
* @return the text
*/
public String getText() {
return text;
}

/**
* @param text the text to set
*/
public void setText(String text) {
this.text = text;
}

@Override
public JsonObject getPublicationValue() {
return getJsonValue(this);
}

}
Loading