RSWidget
.
- */
- public RSWidget getInterface() {
- return methods.interfaces.get(INTERFACE_BANK);
+ return methods.interfaces.getComponent(GlobalWidgetInfo.BANK_TAB).getComponent(index);
}
/**
@@ -336,7 +279,7 @@ public RSWidget getInterface() {
* @return The deposit box RSWidget
.
*/
public RSWidget getBoxInterface() {
- return methods.interfaces.get(INTERFACE_DEPOSIT_BOX);
+ return methods.interfaces.get(GlobalWidgetId.INTERFACE_DEPOSIT_BOX);
}
/**
@@ -358,6 +301,15 @@ public RSItem getItemAt(final int index) {
return null;
}
+ /**
+ * Gets the bank interface.
+ *
+ * @return The bank RSWidget
.
+ */
+ public RSWidget getInterface() {
+ return methods.interfaces.get(GlobalWidgetId.INTERFACE_BANK);
+ }
+
/**
* Gets the first item with the provided ID in the bank.
*
@@ -399,10 +351,11 @@ public Point getItemPoint(final int slot) {
* @return an RSItem
array of the bank's inventory interface.
*/
public RSItem[] getItems() {
- if ((getInterface() == null) || (getInterface().getComponent(INTERFACE_BANK_INVENTORY) == null)) {
+ RSWidget bankInterface = getInterface();
+ if ((bankInterface == null) || (bankInterface.getComponent(GlobalWidgetId.INTERFACE_BANK_INVENTORY) == null)) {
return new RSItem[0];
}
- RSWidget[] components = getInterface().getComponent(INTERFACE_BANK_INVENTORY).getComponents();
+ RSWidget[] components = bankInterface.getComponent(GlobalWidgetId.INTERFACE_BANK_INVENTORY).getComponents();
RSItem[] items = new RSItem[components.length];
for (int i = 0; i < items.length; ++i) {
items[i] = new RSItem(methods, components[i]);
@@ -416,7 +369,8 @@ public RSItem[] getItems() {
* @return true if the bank interface is open; otherwise false.
*/
public boolean isOpen() {
- return getInterface().isValid() && getInterface().isVisible();
+ RSWidget bankInterface = getInterface();
+ return bankInterface.isValid() && bankInterface.isVisible();
}
/**
@@ -425,7 +379,7 @@ public boolean isOpen() {
* @return true if the deposit box interface is open; otherwise false.
*/
public boolean isDepositOpen() {
- return methods.interfaces.get(INTERFACE_DEPOSIT_BOX).isValid();
+ return methods.interfaces.get(GlobalWidgetId.INTERFACE_DEPOSIT_BOX).isValid();
}
private static class ReachableBankerFilter implements Filter
- * To parse a given JSON input, use the parse()
methods like in this
- * example:
- *
- * JsonObject object = Json.parse(string).asObject(); - *- *
- * To create a JSON data structure to be serialized, use the methods
- * value()
, array()
, and object()
. For example, the following
- * snippet will produce the JSON string {"foo": 23, "bar": true}:
- *
- * String string = Json.object().add("foo", 23).add("bar", true).toString(); - *- *
- * To create a JSON array from a given Java array, you can use one of the array()
- * methods with varargs parameters:
- *
- * String[] names = ... - * JsonArray array = Json.array(names); - *- */ -public final class Json { - - private Json() { - // not meant to be instantiated - } - - /** - * Represents the JSON literal
null
.
- */
- public static final JsonValue NULL = new JsonLiteral("null");
-
- /**
- * Represents the JSON literal true
.
- */
- public static final JsonValue TRUE = new JsonLiteral("true");
-
- /**
- * Represents the JSON literal false
.
- */
- public static final JsonValue FALSE = new JsonLiteral("false");
-
- /**
- * Returns a JsonValue instance that represents the given int
value.
- *
- * @param value
- * the value to get a JSON representation for
- * @return a JSON value that represents the given value
- */
- public static JsonValue value(int value) {
- return new JsonNumber(Integer.toString(value, 10));
- }
-
- /**
- * Returns a JsonValue instance that represents the given long
value.
- *
- * @param value
- * the value to get a JSON representation for
- * @return a JSON value that represents the given value
- */
- public static JsonValue value(long value) {
- return new JsonNumber(Long.toString(value, 10));
- }
-
- /**
- * Returns a JsonValue instance that represents the given float
value.
- *
- * @param value
- * the value to get a JSON representation for
- * @return a JSON value that represents the given value
- */
- public static JsonValue value(float value) {
- if (Float.isInfinite(value) || Float.isNaN(value)) {
- throw new IllegalArgumentException("Infinite and NaN values not permitted in JSON");
- }
- return new JsonNumber(cutOffPointZero(Float.toString(value)));
- }
-
- /**
- * Returns a JsonValue instance that represents the given double
value.
- *
- * @param value
- * the value to get a JSON representation for
- * @return a JSON value that represents the given value
- */
- public static JsonValue value(double value) {
- if (Double.isInfinite(value) || Double.isNaN(value)) {
- throw new IllegalArgumentException("Infinite and NaN values not permitted in JSON");
- }
- return new JsonNumber(cutOffPointZero(Double.toString(value)));
- }
-
- /**
- * Returns a JsonValue instance that represents the given string.
- *
- * @param string
- * the string to get a JSON representation for
- * @return a JSON value that represents the given string
- */
- public static JsonValue value(String string) {
- return string == null ? NULL : new JsonString(string);
- }
-
- /**
- * Returns a JsonValue instance that represents the given boolean
value.
- *
- * @param value
- * the value to get a JSON representation for
- * @return a JSON value that represents the given value
- */
- public static JsonValue value(boolean value) {
- return value ? TRUE : FALSE;
- }
-
- /**
- * Creates a new empty JsonArray. This is equivalent to creating a new JsonArray using the
- * constructor.
- *
- * @return a new empty JSON array
- */
- public static JsonArray array() {
- return new JsonArray();
- }
-
- /**
- * Creates a new JsonArray that contains the JSON representations of the given int
- * values.
- *
- * @param values
- * the values to be included in the new JSON array
- * @return a new JSON array that contains the given values
- */
- public static JsonArray array(int... values) {
- if (values == null) {
- throw new NullPointerException("values is null");
- }
- JsonArray array = new JsonArray();
- for (int value : values) {
- array.add(value);
- }
- return array;
- }
-
- /**
- * Creates a new JsonArray that contains the JSON representations of the given long
- * values.
- *
- * @param values
- * the values to be included in the new JSON array
- * @return a new JSON array that contains the given values
- */
- public static JsonArray array(long... values) {
- if (values == null) {
- throw new NullPointerException("values is null");
- }
- JsonArray array = new JsonArray();
- for (long value : values) {
- array.add(value);
- }
- return array;
- }
-
- /**
- * Creates a new JsonArray that contains the JSON representations of the given float
- * values.
- *
- * @param values
- * the values to be included in the new JSON array
- * @return a new JSON array that contains the given values
- */
- public static JsonArray array(float... values) {
- if (values == null) {
- throw new NullPointerException("values is null");
- }
- JsonArray array = new JsonArray();
- for (float value : values) {
- array.add(value);
- }
- return array;
- }
-
- /**
- * Creates a new JsonArray that contains the JSON representations of the given double
- * values.
- *
- * @param values
- * the values to be included in the new JSON array
- * @return a new JSON array that contains the given values
- */
- public static JsonArray array(double... values) {
- if (values == null) {
- throw new NullPointerException("values is null");
- }
- JsonArray array = new JsonArray();
- for (double value : values) {
- array.add(value);
- }
- return array;
- }
-
- /**
- * Creates a new JsonArray that contains the JSON representations of the given
- * boolean
values.
- *
- * @param values
- * the values to be included in the new JSON array
- * @return a new JSON array that contains the given values
- */
- public static JsonArray array(boolean... values) {
- if (values == null) {
- throw new NullPointerException("values is null");
- }
- JsonArray array = new JsonArray();
- for (boolean value : values) {
- array.add(value);
- }
- return array;
- }
-
- /**
- * Creates a new JsonArray that contains the JSON representations of the given strings.
- *
- * @param strings
- * the strings to be included in the new JSON array
- * @return a new JSON array that contains the given strings
- */
- public static JsonArray array(String... strings) {
- if (strings == null) {
- throw new NullPointerException("values is null");
- }
- JsonArray array = new JsonArray();
- for (String value : strings) {
- array.add(value);
- }
- return array;
- }
-
- /**
- * Creates a new empty JsonObject. This is equivalent to creating a new JsonObject using the
- * constructor.
- *
- * @return a new empty JSON object
- */
- public static JsonObject object() {
- return new JsonObject();
- }
-
- /**
- * Parses the given input string as JSON. The input must contain a valid JSON value, optionally
- * padded with whitespace.
- *
- * @param string
- * the input string, must be valid JSON
- * @return a value that represents the parsed JSON
- * @throws ParseException
- * if the input is not valid JSON
- */
- public static JsonValue parse(String string) {
- if (string == null) {
- throw new NullPointerException("string is null");
- }
- DefaultHandler handler = new DefaultHandler();
- new JsonParser(handler).parse(string);
- return handler.getValue();
- }
-
- /**
- * Reads the entire input from the given reader and parses it as JSON. The input must contain a
- * valid JSON value, optionally padded with whitespace.
- *
- * Characters are read in chunks into an input buffer. Hence, wrapping a reader in an additional
- * BufferedReader
likely won't improve reading performance.
- *
- * Elements can be added using the add(...)
methods which accept instances of
- * {@link JsonValue}, strings, primitive numbers, and boolean values. To replace an element of an
- * array, use the set(int, ...)
methods.
- *
- * Elements can be accessed by their index using {@link #get(int)}. This class also supports - * iterating over the elements in document order using an {@link #iterator()} or an enhanced for - * loop: - *
- *- * for (JsonValue value : jsonArray) { - * ... - * } - *- *
- * An equivalent {@link List} can be obtained from the method {@link #values()}. - *
- *
- * Note that this class is not thread-safe. If multiple threads access a
- * JsonArray
instance concurrently, while at least one of these threads modifies the
- * contents of this array, access to the instance must be synchronized externally. Failure to do so
- * may lead to an inconsistent state.
- *
- * This class is not supposed to be extended by clients. - *
- */ -@SuppressWarnings("serial") // use default serial UID -public class JsonArray extends JsonValue implements Iterablenull
- */
- public JsonArray(JsonArray array) {
- this(array, false);
- }
-
- private JsonArray(JsonArray array, boolean unmodifiable) {
- if (array == null) {
- throw new NullPointerException("array is null");
- }
- if (unmodifiable) {
- values = Collections.unmodifiableList(array.values);
- } else {
- values = new ArrayList
- * Characters are read in chunks and buffered internally, therefore wrapping an existing reader in
- * an additional BufferedReader
does not improve reading
- * performance.
- *
- * The returned JsonArray is backed by the given array and reflects subsequent changes. Attempts
- * to modify the returned JsonArray result in an UnsupportedOperationException
.
- *
int
value to the end of this
- * array.
- *
- * @param value
- * the value to add to the array
- * @return the array itself, to enable method chaining
- */
- public JsonArray add(int value) {
- values.add(Json.value(value));
- return this;
- }
-
- /**
- * Appends the JSON representation of the specified long
value to the end of this
- * array.
- *
- * @param value
- * the value to add to the array
- * @return the array itself, to enable method chaining
- */
- public JsonArray add(long value) {
- values.add(Json.value(value));
- return this;
- }
-
- /**
- * Appends the JSON representation of the specified float
value to the end of this
- * array.
- *
- * @param value
- * the value to add to the array
- * @return the array itself, to enable method chaining
- */
- public JsonArray add(float value) {
- values.add(Json.value(value));
- return this;
- }
-
- /**
- * Appends the JSON representation of the specified double
value to the end of this
- * array.
- *
- * @param value
- * the value to add to the array
- * @return the array itself, to enable method chaining
- */
- public JsonArray add(double value) {
- values.add(Json.value(value));
- return this;
- }
-
- /**
- * Appends the JSON representation of the specified boolean
value to the end of this
- * array.
- *
- * @param value
- * the value to add to the array
- * @return the array itself, to enable method chaining
- */
- public JsonArray add(boolean value) {
- values.add(Json.value(value));
- return this;
- }
-
- /**
- * Appends the JSON representation of the specified string to the end of this array.
- *
- * @param value
- * the string to add to the array
- * @return the array itself, to enable method chaining
- */
- public JsonArray add(String value) {
- values.add(Json.value(value));
- return this;
- }
-
- /**
- * Appends the specified JSON value to the end of this array.
- *
- * @param value
- * the JsonValue to add to the array, must not be null
- * @return the array itself, to enable method chaining
- */
- public JsonArray add(JsonValue value) {
- if (value == null) {
- throw new NullPointerException("value is null");
- }
- values.add(value);
- return this;
- }
-
- /**
- * Replaces the element at the specified position in this array with the JSON representation of
- * the specified int
value.
- *
- * @param index
- * the index of the array element to replace
- * @param value
- * the value to be stored at the specified array position
- * @return the array itself, to enable method chaining
- * @throws IndexOutOfBoundsException
- * if the index is out of range, i.e. index < 0
or
- * index >= size
- */
- public JsonArray set(int index, int value) {
- values.set(index, Json.value(value));
- return this;
- }
-
- /**
- * Replaces the element at the specified position in this array with the JSON representation of
- * the specified long
value.
- *
- * @param index
- * the index of the array element to replace
- * @param value
- * the value to be stored at the specified array position
- * @return the array itself, to enable method chaining
- * @throws IndexOutOfBoundsException
- * if the index is out of range, i.e. index < 0
or
- * index >= size
- */
- public JsonArray set(int index, long value) {
- values.set(index, Json.value(value));
- return this;
- }
-
- /**
- * Replaces the element at the specified position in this array with the JSON representation of
- * the specified float
value.
- *
- * @param index
- * the index of the array element to replace
- * @param value
- * the value to be stored at the specified array position
- * @return the array itself, to enable method chaining
- * @throws IndexOutOfBoundsException
- * if the index is out of range, i.e. index < 0
or
- * index >= size
- */
- public JsonArray set(int index, float value) {
- values.set(index, Json.value(value));
- return this;
- }
-
- /**
- * Replaces the element at the specified position in this array with the JSON representation of
- * the specified double
value.
- *
- * @param index
- * the index of the array element to replace
- * @param value
- * the value to be stored at the specified array position
- * @return the array itself, to enable method chaining
- * @throws IndexOutOfBoundsException
- * if the index is out of range, i.e. index < 0
or
- * index >= size
- */
- public JsonArray set(int index, double value) {
- values.set(index, Json.value(value));
- return this;
- }
-
- /**
- * Replaces the element at the specified position in this array with the JSON representation of
- * the specified boolean
value.
- *
- * @param index
- * the index of the array element to replace
- * @param value
- * the value to be stored at the specified array position
- * @return the array itself, to enable method chaining
- * @throws IndexOutOfBoundsException
- * if the index is out of range, i.e. index < 0
or
- * index >= size
- */
- public JsonArray set(int index, boolean value) {
- values.set(index, Json.value(value));
- return this;
- }
-
- /**
- * Replaces the element at the specified position in this array with the JSON representation of
- * the specified string.
- *
- * @param index
- * the index of the array element to replace
- * @param value
- * the string to be stored at the specified array position
- * @return the array itself, to enable method chaining
- * @throws IndexOutOfBoundsException
- * if the index is out of range, i.e. index < 0
or
- * index >= size
- */
- public JsonArray set(int index, String value) {
- values.set(index, Json.value(value));
- return this;
- }
-
- /**
- * Replaces the element at the specified position in this array with the specified JSON value.
- *
- * @param index
- * the index of the array element to replace
- * @param value
- * the value to be stored at the specified array position, must not be null
- * @return the array itself, to enable method chaining
- * @throws IndexOutOfBoundsException
- * if the index is out of range, i.e. index < 0
or
- * index >= size
- */
- public JsonArray set(int index, JsonValue value) {
- if (value == null) {
- throw new NullPointerException("value is null");
- }
- values.set(index, value);
- return this;
- }
-
- /**
- * Removes the element at the specified index from this array.
- *
- * @param index
- * the index of the element to remove
- * @return the array itself, to enable method chaining
- * @throws IndexOutOfBoundsException
- * if the index is out of range, i.e. index < 0
or
- * index >= size
- */
- public JsonArray remove(int index) {
- values.remove(index);
- return this;
- }
-
- /**
- * Returns the number of elements in this array.
- *
- * @return the number of elements in this array
- */
- public int size() {
- return values.size();
- }
-
- /**
- * Returns true
if this array contains no elements.
- *
- * @return true
if this array contains no elements
- */
- public boolean isEmpty() {
- return values.isEmpty();
- }
-
- /**
- * Returns the value of the element at the specified position in this array.
- *
- * @param index
- * the index of the array element to return
- * @return the value of the element at the specified position
- * @throws IndexOutOfBoundsException
- * if the index is out of range, i.e. index < 0
or
- * index >= size
- */
- public JsonValue get(int index) {
- return values.get(index);
- }
-
- /**
- * Returns a list of the values in this array in document order. The returned list is backed by
- * this array and will reflect subsequent changes. It cannot be used to modify this array.
- * Attempts to modify the returned list will result in an exception.
- *
- * @return a list of the values in this array
- */
- public ListJsonArray
and both arrays contain the same list of values.
- * - * If two JsonArrays are equal, they will also produce the same JSON output. - *
- * - * @param object - * the object to be compared with this JsonArray - * @return true if the specified object is equal to this JsonArray,false
- * otherwise
- */
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object == null) {
- return false;
- }
- if (getClass() != object.getClass()) {
- return false;
- }
- JsonArray other = (JsonArray)object;
- return values.equals(other.values);
- }
-
-}
diff --git a/src/main/java/rsb/walker/dax_api/api_lib/json/JsonHandler.java b/src/main/java/rsb/walker/dax_api/api_lib/json/JsonHandler.java
deleted file mode 100644
index 1bc54c34..00000000
--- a/src/main/java/rsb/walker/dax_api/api_lib/json/JsonHandler.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2016 EclipseSource.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- ******************************************************************************/
-package rsb.walker.dax_api.api_lib.json;
-
-
-/**
- * A handler for parser events. Instances of this class can be given to a {@link JsonParser}. The
- * parser will then call the methods of the given handler while reading the input.
- *
- * The default implementations of these methods do nothing. Subclasses may override only those
- * methods they are interested in. They can use getLocation()
to access the current
- * character position of the parser at any point. The start*
methods will be called
- * while the location points to the first character of the parsed element. The end*
- * methods will be called while the location points to the character position that directly follows
- * the last character of the parsed element. Example:
- *
- * ["lorem ipsum"] - * ^ ^ - * startString endString - *- *
- * Subclasses that build an object representation of the parsed JSON can return arbitrary handler - * objects for JSON arrays and JSON objects in {@link #startArray()} and {@link #startObject()}. - * These handler objects will then be provided in all subsequent parser events for this particular - * array or object. They can be used to keep track the elements of a JSON array or object. - *
- * - * @param - * The type of handlers used for JSON arrays - * @paramnull
literal in the JSON input. This method will be
- * called when reading the first character of the literal.
- */
- public void startNull() {
- }
-
- /**
- * Indicates the end of a null
literal in the JSON input. This method will be called
- * after reading the last character of the literal.
- */
- public void endNull() {
- }
-
- /**
- * Indicates the beginning of a boolean literal (true
or false
) in the
- * JSON input. This method will be called when reading the first character of the literal.
- */
- public void startBoolean() {
- }
-
- /**
- * Indicates the end of a boolean literal (true
or false
) in the JSON
- * input. This method will be called after reading the last character of the literal.
- *
- * @param value
- * the parsed boolean value
- */
- public void endBoolean(boolean value) {
- }
-
- /**
- * Indicates the beginning of a string in the JSON input. This method will be called when reading
- * the opening double quote character ('"'
).
- */
- public void startString() {
- }
-
- /**
- * Indicates the end of a string in the JSON input. This method will be called after reading the
- * closing double quote character ('"'
).
- *
- * @param string
- * the parsed string
- */
- public void endString(String string) {
- }
-
- /**
- * Indicates the beginning of a number in the JSON input. This method will be called when reading
- * the first character of the number.
- */
- public void startNumber() {
- }
-
- /**
- * Indicates the end of a number in the JSON input. This method will be called after reading the
- * last character of the number.
- *
- * @param string
- * the parsed number string
- */
- public void endNumber(String string) {
- }
-
- /**
- * Indicates the beginning of an array in the JSON input. This method will be called when reading
- * the opening square bracket character ('['
).
- * - * This method may return an object to handle subsequent parser events for this array. This array - * handler will then be provided in all calls to {@link #startArrayValue(Object) - * startArrayValue()}, {@link #endArrayValue(Object) endArrayValue()}, and - * {@link #endArray(Object) endArray()} for this array. - *
- * - * @return a handler for this array, ornull
if not needed
- */
- public A startArray() {
- return null;
- }
-
- /**
- * Indicates the end of an array in the JSON input. This method will be called after reading the
- * closing square bracket character (']'
).
- *
- * @param array
- * the array handler returned from {@link #startArray()}, or null
if not
- * provided
- */
- public void endArray(A array) {
- }
-
- /**
- * Indicates the beginning of an array element in the JSON input. This method will be called when
- * reading the first character of the element, just before the call to the start
- * method for the specific element type ({@link #startString()}, {@link #startNumber()}, etc.).
- *
- * @param array
- * the array handler returned from {@link #startArray()}, or null
if not
- * provided
- */
- public void startArrayValue(A array) {
- }
-
- /**
- * Indicates the end of an array element in the JSON input. This method will be called after
- * reading the last character of the element value, just after the end
method for the
- * specific element type (like {@link #endString(String) endString()}, {@link #endNumber(String)
- * endNumber()}, etc.).
- *
- * @param array
- * the array handler returned from {@link #startArray()}, or null
if not
- * provided
- */
- public void endArrayValue(A array) {
- }
-
- /**
- * Indicates the beginning of an object in the JSON input. This method will be called when reading
- * the opening curly bracket character ('{'
).
- * - * This method may return an object to handle subsequent parser events for this object. This - * object handler will be provided in all calls to {@link #startObjectName(Object) - * startObjectName()}, {@link #endObjectName(Object, String) endObjectName()}, - * {@link #startObjectValue(Object, String) startObjectValue()}, - * {@link #endObjectValue(Object, String) endObjectValue()}, and {@link #endObject(Object) - * endObject()} for this object. - *
- * - * @return a handler for this object, ornull
if not needed
- */
- public O startObject() {
- return null;
- }
-
- /**
- * Indicates the end of an object in the JSON input. This method will be called after reading the
- * closing curly bracket character ('}'
).
- *
- * @param object
- * the object handler returned from {@link #startObject()}, or null if not provided
- */
- public void endObject(O object) {
- }
-
- /**
- * Indicates the beginning of the name of an object member in the JSON input. This method will be
- * called when reading the opening quote character ('"') of the member name.
- *
- * @param object
- * the object handler returned from {@link #startObject()}, or null
if not
- * provided
- */
- public void startObjectName(O object) {
- }
-
- /**
- * Indicates the end of an object member name in the JSON input. This method will be called after
- * reading the closing quote character ('"'
) of the member name.
- *
- * @param object
- * the object handler returned from {@link #startObject()}, or null if not provided
- * @param name
- * the parsed member name
- */
- public void endObjectName(O object, String name) {
- }
-
- /**
- * Indicates the beginning of the name of an object member in the JSON input. This method will be
- * called when reading the opening quote character ('"') of the member name.
- *
- * @param object
- * the object handler returned from {@link #startObject()}, or null
if not
- * provided
- * @param name
- * the member name
- */
- public void startObjectValue(O object, String name) {
- }
-
- /**
- * Indicates the end of an object member value in the JSON input. This method will be called after
- * reading the last character of the member value, just after the end
method for the
- * specific member type (like {@link #endString(String) endString()}, {@link #endNumber(String)
- * endNumber()}, etc.).
- *
- * @param object
- * the object handler returned from {@link #startObject()}, or null if not provided
- * @param name
- * the parsed member name
- */
- public void endObjectValue(O object, String name) {
- }
-
-}
diff --git a/src/main/java/rsb/walker/dax_api/api_lib/json/JsonLiteral.java b/src/main/java/rsb/walker/dax_api/api_lib/json/JsonLiteral.java
deleted file mode 100644
index 7cfe189b..00000000
--- a/src/main/java/rsb/walker/dax_api/api_lib/json/JsonLiteral.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2015 EclipseSource.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- ******************************************************************************/
-package rsb.walker.dax_api.api_lib.json;
-
-import java.io.IOException;
-
-
-@SuppressWarnings("serial") // use default serial UID
-class JsonLiteral extends JsonValue {
-
- private final String value;
- private final boolean isNull;
- private final boolean isTrue;
- private final boolean isFalse;
-
- JsonLiteral(String value) {
- this.value = value;
- isNull = "null".equals(value);
- isTrue = "true".equals(value);
- isFalse = "false".equals(value);
- }
-
- @Override
- void write(JsonWriter writer) throws IOException {
- writer.writeLiteral(value);
- }
-
- @Override
- public String toString() {
- return value;
- }
-
- @Override
- public int hashCode() {
- return value.hashCode();
- }
-
- @Override
- public boolean isNull() {
- return isNull;
- }
-
- @Override
- public boolean isTrue() {
- return isTrue;
- }
-
- @Override
- public boolean isFalse() {
- return isFalse;
- }
-
- @Override
- public boolean isBoolean() {
- return isTrue || isFalse;
- }
-
- @Override
- public boolean asBoolean() {
- return isNull ? super.asBoolean() : isTrue;
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object == null) {
- return false;
- }
- if (getClass() != object.getClass()) {
- return false;
- }
- JsonLiteral other = (JsonLiteral)object;
- return value.equals(other.value);
- }
-
-}
diff --git a/src/main/java/rsb/walker/dax_api/api_lib/json/JsonNumber.java b/src/main/java/rsb/walker/dax_api/api_lib/json/JsonNumber.java
deleted file mode 100644
index 4c13bcb7..00000000
--- a/src/main/java/rsb/walker/dax_api/api_lib/json/JsonNumber.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2015 EclipseSource.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- ******************************************************************************/
-package rsb.walker.dax_api.api_lib.json;
-
-import java.io.IOException;
-
-
-@SuppressWarnings("serial") // use default serial UID
-class JsonNumber extends JsonValue {
-
- private final String string;
-
- JsonNumber(String string) {
- if (string == null) {
- throw new NullPointerException("string is null");
- }
- this.string = string;
- }
-
- @Override
- public String toString() {
- return string;
- }
-
- @Override
- void write(JsonWriter writer) throws IOException {
- writer.writeNumber(string);
- }
-
- @Override
- public boolean isNumber() {
- return true;
- }
-
- @Override
- public int asInt() {
- return Integer.parseInt(string, 10);
- }
-
- @Override
- public long asLong() {
- return Long.parseLong(string, 10);
- }
-
- @Override
- public float asFloat() {
- return Float.parseFloat(string);
- }
-
- @Override
- public double asDouble() {
- return Double.parseDouble(string);
- }
-
- @Override
- public int hashCode() {
- return string.hashCode();
- }
-
- @Override
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object == null) {
- return false;
- }
- if (getClass() != object.getClass()) {
- return false;
- }
- JsonNumber other = (JsonNumber)object;
- return string.equals(other.string);
- }
-
-}
diff --git a/src/main/java/rsb/walker/dax_api/api_lib/json/JsonObject.java b/src/main/java/rsb/walker/dax_api/api_lib/json/JsonObject.java
deleted file mode 100644
index d0af49b9..00000000
--- a/src/main/java/rsb/walker/dax_api/api_lib/json/JsonObject.java
+++ /dev/null
@@ -1,932 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2015 EclipseSource.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- ******************************************************************************/
-package rsb.walker.dax_api.api_lib.json;
-
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-
-/**
- * Represents a JSON object, a set of name/value pairs, where the names are strings and the values
- * are JSON values.
- *
- * Members can be added using the add(String, ...)
methods which accept instances of
- * {@link JsonValue}, strings, primitive numbers, and boolean values. To modify certain values of an
- * object, use the set(String, ...)
methods. Please note that the add
- * methods are faster than set
as they do not search for existing members. On the other
- * hand, the add
methods do not prevent adding multiple members with the same name.
- * Duplicate names are discouraged but not prohibited by JSON.
- *
- * Members can be accessed by their name using {@link #get(String)}. A list of all names can be - * obtained from the method {@link #names()}. This class also supports iterating over the members in - * document order using an {@link #iterator()} or an enhanced for loop: - *
- *- * for (Member member : jsonObject) { - * String name = member.getName(); - * JsonValue value = member.getValue(); - * ... - * } - *- *
- * Even though JSON objects are unordered by definition, instances of this class preserve the order - * of members to allow processing in document order and to guarantee a predictable output. - *
- *
- * Note that this class is not thread-safe. If multiple threads access a
- * JsonObject
instance concurrently, while at least one of these threads modifies the
- * contents of this object, access to the instance must be synchronized externally. Failure to do so
- * may lead to an inconsistent state.
- *
- * This class is not supposed to be extended by clients. - *
- */ -@SuppressWarnings("serial") // use default serial UID -public class JsonObject extends JsonValue implements Iterablenull
- */
- public JsonObject(JsonObject object) {
- this(object, false);
- }
-
- private JsonObject(JsonObject object, boolean unmodifiable) {
- if (object == null) {
- throw new NullPointerException("object is null");
- }
- if (unmodifiable) {
- names = Collections.unmodifiableList(object.names);
- values = Collections.unmodifiableList(object.values);
- } else {
- names = new ArrayList