Class Viv
- Running/Deserialization function
Viv.runorViv.runEx: Run VivJson's code or deserialize JSON objects.Viv.parseorViv.parseEx: Parse VivJson's code and JSON object.Viv.parseFileorViv.parseFileEx: Parse a file that contains VivJson's code or JSON object.Viv.parseTextorViv.parseTextEx: Parse a text that is VivJson's code or JSON object.Viv.makeInstanceorViv.makeInstanceEx: Makes a class instance.
- Monolithic conversion (with running/deserialization function)
Viv.getBooleanorViv.getBooleanEx: Get a boolean.Viv.getIntegerorViv.getIntegerEx: Get an integer.Viv.getLongorViv.getLongEx: Get a long integer.Viv.getFloatorViv.getFloatEx: Get a floating-point number.Viv.getDoubleorViv.getDoubleEx: Get a double-precision floating-point number.Viv.getStringorViv.getStringEx: Get a string.
- Array conversion (with running/deserialization function)
Viv.getBooleansorViv.getBooleansEx: Get an array of boolean.Viv.getBooleanOrNullsorViv.getBooleanOrNullsEx: Get an array of@Nullable Boolean.Viv.getIntegersorViv.getIntegersEx: Get an array of integer.Viv.getIntegerOrNullsorViv.getIntegerOrNullsEx: Get an array of@Nullable Integer.Viv.getLongsorViv.getLongsEx: Get an array of long integer.Viv.getLongOrNullsorViv.getLongOrNullsEx: Get an array of@Nullable Long.Viv.getFloatsorViv.getFloatsEx: Get an array of floating-point number.Viv.getFloatOrNullsorViv.getFloatOrNullsEx: Get an array of@Nullable Float.Viv.getDoublesorViv.getDoublesEx: Get an array of double-precision floating-point number.Viv.getDoubleOrNullsorViv.getDoubleOrNullsEx: Get an array of@Nullable Double.Viv.getStringsorViv.getStringsEx: Get an array of String.Viv.getStringOrNullsorViv.getStringOrNullsEx: Get an array of@Nullable String.Viv.getObjectsorViv.getObjectsEx: Get an array of Object.Viv.getObjectOrNullsorViv.getObjectOrNullsEx: Get an array of@Nullable Object.
- Key-Value pairs conversion (with running/deserialization function)
Viv.getKeyValueBooleansorViv.getKeyValueBooleansEx: Get key-value pairs as an array ofViv.KeyValue<Boolean>.Viv.getKeyValueBooleanOrNullsorViv.getKeyValueBooleanOrNullsEx: Get key-value pairs as an array ofViv.KeyValue<@Nullable Boolean>.Viv.getKeyValueIntegersorViv.getKeyValueIntegersEx: Get key-value pairs as an array ofViv.KeyValue<Integer>.Viv.getKeyValueIntegerOrNullsorViv.getKeyValueIntegerOrNullsEx: Get key-value pairs as an array ofViv.KeyValue<@Nullable Integer>.Viv.getKeyValueLongsorViv.getKeyValueLongsEx: Get key-value pairs as an array ofViv.KeyValue<Long>.Viv.getKeyValueLongOrNullsorViv.getKeyValueLongOrNullsEx: Get key-value pairs as an array ofViv.KeyValue<@Nullable Long>.Viv.getKeyValueFloatsorViv.getKeyValueFloatsEx: Get key-value pairs as an array ofViv.KeyValue<Float>.Viv.getKeyValueFloatOrNullsorViv.getKeyValueFloatOrNullsEx: Get key-value pairs as an array ofViv.KeyValue<@Nullable Float>.Viv.getKeyValueDoublesorViv.getKeyValueDoublesEx: Get key-value pairs as an array ofViv.KeyValue<Double>.Viv.getKeyValueDoubleOrNullsorViv.getKeyValueDoubleOrNullsEx: Get key-value pairs as an array ofViv.KeyValue<@Nullable Double>.Viv.getKeyValueStringsorViv.getKeyValueStringsEx: Get key-value pairs as an array ofViv.KeyValue<String>.Viv.getKeyValueStringOrNullsorViv.getKeyValueStringOrNullsEx: Get key-value pairs as an array ofViv.KeyValue<@Nullable String>.Viv.getKeyValueObjectsorViv.getKeyValueObjectsEx: Get key-value pairs as an array ofViv.KeyValue<Object>.Viv.getKeyValueObjectOrNullsorViv.getKeyValueObjectOrNullsEx: Get key-value pairs as an array ofViv.KeyValue<@Nullable Object>.
- Other conversion (with running/deserialization function)
Viv.getArrayListorViv.getArrayListEx: Get anArrayList<@Nullable Object>.Viv.getHashMaporViv.getHashMapEx: Get aHashMap<String, @Nullable Object>.
- String conversion (without running/deserialization function)
Viv.makeString: Convert into String. Serialize into JSON string.
The relationship of this script's value and Java's value are
described as below.
Note that the following "block" is equivalent to JSON's object.
| This script's value | Java's value |
|---------------------|-----------------------------------|
| boolean | Boolean |
| int | Long |
| float | Double |
| string | String |
| array | ArrayList<@Nullable Object> |
| block | HashMap<String, @Nullable Object> |
| null | null |
"@Nullable Object" of ArrayList/HashMap is also the above
right-hand sided value.In
Viv.runEx method, the argument is
the above left-hand sided value, script's code, or parsed statement
(Refer to parse(Object...) Viv.parse). And its returned
value is the above right-hand sided value.Then the exception is thrown if error occurs.
On the other hand,
Viv.run method does not
throw the exception even if error occurs. Because its returned value
is a class instance that has not only the value but also error
message.To tell the truth, the returned value of
Viv.runEx method is Object
even if the actual value is Boolean, Long, and so
on. So conversion functions are available. They can be accepted
the above left-hand sided value, script's code, or parsed statement
as argument. In other words, they can be used instead of
Viv.runEx method.
Environment: Java 9 or later
Last modified: 2025-03-30
- Author:
- Fumiaki Motegi (motegi@benesult.com)
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInstance data class.static classJSON data class.static classKey-Value pair data class.static classParsed data class.static classResult data class. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetArrayList(@Nullable Object... objects) Gets anArrayList<@Nullable Object>.getArrayList(@Nullable Object[] objects, @Nullable Config config) Gets anArrayList<@Nullable Object>.getArrayListEx(@Nullable Object... objects) Gets anArrayList<@Nullable Object>.getArrayListEx(@Nullable Object[] objects, @Nullable Config config) Gets anArrayList<@Nullable Object>.static @Nullable BooleangetBoolean(@Nullable Object... objects) Gets a boolean.static @Nullable BooleangetBoolean(@Nullable Object[] objects, @Nullable Config config) Gets a boolean.static booleangetBooleanEx(@Nullable Object... objects) Gets a boolean.static booleangetBooleanEx(@Nullable Object[] objects, @Nullable Config config) Gets a boolean.static @Nullable Boolean @Nullable []getBooleanOrNulls(@Nullable Object... objects) Gets an array of boolean.static @Nullable Boolean @Nullable []getBooleanOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets an array of boolean.static @Nullable Boolean[]getBooleanOrNullsEx(@Nullable Object... objects) Gets an array of boolean.static @Nullable Boolean[]getBooleanOrNullsEx(@Nullable Object[] objects, @Nullable Config config) Gets an array of boolean.static boolean @Nullable []getBooleans(@Nullable Object... objects) Gets an array of boolean.static boolean @Nullable []getBooleans(@Nullable Object[] objects, @Nullable Config config) Gets an array of boolean.static boolean[]getBooleansEx(@Nullable Object... objects) Gets an array of boolean.static boolean[]getBooleansEx(@Nullable Object[] objects, @Nullable Config config) Gets an array of boolean.static @Nullable DoubleGets a double-precision floating-point number.static @Nullable DoubleGets a double-precision floating-point number.static doublegetDoubleEx(@Nullable Object... objects) Gets a double-precision floating-point number.static doublegetDoubleEx(@Nullable Object[] objects, @Nullable Config config) Gets a double-precision floating-point number.static @Nullable Double @Nullable []getDoubleOrNulls(@Nullable Object... objects) Gets an array of double-precision floating-point number.static @Nullable Double @Nullable []getDoubleOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets an array of double-precision floating-point number.static @Nullable Double[]getDoubleOrNullsEx(@Nullable Object... objects) Gets an array of double-precision floating-point number.static @Nullable Double[]getDoubleOrNullsEx(@Nullable Object[] objects, @Nullable Config config) Gets an array of double-precision floating-point number.static double @Nullable []getDoubles(@Nullable Object... objects) Gets an array of double-precision floating-point number.static double @Nullable []getDoubles(@Nullable Object[] objects, @Nullable Config config) Gets an array of double-precision floating-point number.static double[]getDoublesEx(@Nullable Object... objects) Gets an array of double-precision floating-point number.static double[]getDoublesEx(@Nullable Object[] objects, @Nullable Config config) Gets an array of double-precision floating-point number.static @Nullable FloatGets a floating-point number.static @Nullable FloatGets a floating-point number.static floatgetFloatEx(@Nullable Object... objects) Gets a floating-point number.static floatgetFloatEx(@Nullable Object[] objects, @Nullable Config config) Gets a floating-point number.static @Nullable Float @Nullable []getFloatOrNulls(@Nullable Object... objects) Gets an array of floating-point number.static @Nullable Float @Nullable []getFloatOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets an array of floating-point number.static @Nullable Float[]getFloatOrNullsEx(@Nullable Object... objects) Gets an array of floating-point number.static @Nullable Float[]getFloatOrNullsEx(@Nullable Object[] objects, @Nullable Config config) Gets an array of floating-point number.static float @Nullable []Gets an array of floating-point number.static float @Nullable []Gets an array of floating-point number.static float[]getFloatsEx(@Nullable Object... objects) Gets an array of floating-point number.static float[]getFloatsEx(@Nullable Object[] objects, @Nullable Config config) Gets an array of floating-point number.getHashMap(@Nullable Object... objects) Gets aHashMap<String, @Nullable Object>.getHashMap(@Nullable Object[] objects, @Nullable Config config) Gets aHashMap<String, @Nullable Object>.getHashMapEx(@Nullable Object... objects) Gets aHashMap<String, @Nullable Object>.getHashMapEx(@Nullable Object[] objects, @Nullable Config config) Gets aHashMap<String, @Nullable Object>.static @Nullable IntegergetInteger(@Nullable Object... objects) Gets an integer.static @Nullable IntegergetInteger(@Nullable Object[] objects, @Nullable Config config) Gets an integer.static intgetIntegerEx(@Nullable Object... objects) Gets an integer.static intgetIntegerEx(@Nullable Object[] objects, @Nullable Config config) Gets an integer.static @Nullable Integer @Nullable []getIntegerOrNulls(@Nullable Object... objects) Gets an array of integer.static @Nullable Integer @Nullable []getIntegerOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets an array of integer.static @Nullable Integer[]getIntegerOrNullsEx(@Nullable Object... objects) Gets an array of integer.static @Nullable Integer[]getIntegerOrNullsEx(@Nullable Object[] objects, @Nullable Config config) Gets an array of integer.static int @Nullable []getIntegers(@Nullable Object... objects) Gets an array of integer.static int @Nullable []getIntegers(@Nullable Object[] objects, @Nullable Config config) Gets an array of integer.static int[]getIntegersEx(@Nullable Object... objects) Gets an array of integer.static int[]getIntegersEx(@Nullable Object[] objects, @Nullable Config config) Gets an array of integer.static Viv.KeyValue<@Nullable Boolean> @Nullable []getKeyValueBooleanOrNulls(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Boolean> @Nullable []getKeyValueBooleanOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Boolean>[]getKeyValueBooleanOrNullsEx(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Boolean>[]getKeyValueBooleanOrNullsEx(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<Boolean> @Nullable []getKeyValueBooleans(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<Boolean> @Nullable []getKeyValueBooleans(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<Boolean>[]getKeyValueBooleansEx(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<Boolean>[]getKeyValueBooleansEx(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Double> @Nullable []getKeyValueDoubleOrNulls(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Double> @Nullable []getKeyValueDoubleOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Double>[]getKeyValueDoubleOrNullsEx(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Double>[]getKeyValueDoubleOrNullsEx(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<Double> @Nullable []getKeyValueDoubles(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<Double> @Nullable []getKeyValueDoubles(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<Double>[]getKeyValueDoublesEx(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<Double>[]getKeyValueDoublesEx(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Float> @Nullable []getKeyValueFloatOrNulls(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Float> @Nullable []getKeyValueFloatOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Float>[]getKeyValueFloatOrNullsEx(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Float>[]getKeyValueFloatOrNullsEx(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<Float> @Nullable []getKeyValueFloats(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<Float> @Nullable []getKeyValueFloats(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<Float>[]getKeyValueFloatsEx(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<Float>[]getKeyValueFloatsEx(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Integer> @Nullable []getKeyValueIntegerOrNulls(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Integer> @Nullable []getKeyValueIntegerOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Integer>[]getKeyValueIntegerOrNullsEx(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Integer>[]getKeyValueIntegerOrNullsEx(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<Integer> @Nullable []getKeyValueIntegers(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<Integer> @Nullable []getKeyValueIntegers(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<Integer>[]getKeyValueIntegersEx(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<Integer>[]getKeyValueIntegersEx(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Long> @Nullable []getKeyValueLongOrNulls(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Long> @Nullable []getKeyValueLongOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Long>[]getKeyValueLongOrNullsEx(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Long>[]getKeyValueLongOrNullsEx(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<Long> @Nullable []getKeyValueLongs(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<Long> @Nullable []getKeyValueLongs(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<Long>[]getKeyValueLongsEx(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<Long>[]getKeyValueLongsEx(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Object> @Nullable []getKeyValueObjectOrNulls(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Object> @Nullable []getKeyValueObjectOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Object>[]getKeyValueObjectOrNullsEx(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable Object>[]getKeyValueObjectOrNullsEx(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<Object> @Nullable []getKeyValueObjects(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<Object> @Nullable []getKeyValueObjects(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<Object>[]getKeyValueObjectsEx(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<Object>[]getKeyValueObjectsEx(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable String> @Nullable []getKeyValueStringOrNulls(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable String> @Nullable []getKeyValueStringOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable String>[]getKeyValueStringOrNullsEx(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<@Nullable String>[]getKeyValueStringOrNullsEx(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<String> @Nullable []getKeyValueStrings(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<String> @Nullable []getKeyValueStrings(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static Viv.KeyValue<String>[]getKeyValueStringsEx(@Nullable Object... objects) Gets key-value pairs as an array.static Viv.KeyValue<String>[]getKeyValueStringsEx(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array.static @Nullable LongGets a long integer.static @Nullable LongGets a long integer.static longGets a long integer.static longGets a long integer.static @Nullable Long @Nullable []getLongOrNulls(@Nullable Object... objects) Gets an array of long integer.static @Nullable Long @Nullable []getLongOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets an array of long integer.static @Nullable Long[]getLongOrNullsEx(@Nullable Object... objects) Gets an array of long integer.static @Nullable Long[]getLongOrNullsEx(@Nullable Object[] objects, @Nullable Config config) Gets an array of long integer.static long @Nullable []Gets an array of long integer.static long @Nullable []Gets an array of long integer.static long[]getLongsEx(@Nullable Object... objects) Gets an array of long integer.static long[]getLongsEx(@Nullable Object[] objects, @Nullable Config config) Gets an array of long integer.static @Nullable Object @Nullable []getObjectOrNulls(@Nullable Object... objects) Gets an array of object.static @Nullable Object @Nullable []getObjectOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets an array of object.static @Nullable Object[]getObjectOrNullsEx(@Nullable Object... objects) Gets an array of object.static @Nullable Object[]getObjectOrNullsEx(@Nullable Object[] objects, @Nullable Config config) Gets an array of object.static Object @Nullable []getObjects(@Nullable Object... objects) Gets an array of object.static Object @Nullable []getObjects(@Nullable Object[] objects, @Nullable Config config) Gets an array of object.static Object[]getObjectsEx(@Nullable Object... objects) Gets an array of object.static Object[]getObjectsEx(@Nullable Object[] objects, @Nullable Config config) Gets an array of object.static @Nullable StringGets a string.static @Nullable StringGets a string.static StringgetStringEx(@Nullable Object... objects) Gets a string.static StringgetStringEx(@Nullable Object[] objects, @Nullable Config config) Gets a string.static @Nullable String @Nullable []getStringOrNulls(@Nullable Object... objects) Gets an array of string.static @Nullable String @Nullable []getStringOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets an array of string.static @Nullable String[]getStringOrNullsEx(@Nullable Object... objects) Gets an array of string.static @Nullable String[]getStringOrNullsEx(@Nullable Object[] objects, @Nullable Config config) Gets an array of String.static String @Nullable []getStrings(@Nullable Object... objects) Gets an array of string.static String @Nullable []getStrings(@Nullable Object[] objects, @Nullable Config config) Gets an array of string.static String[]getStringsEx(@Nullable Object... objects) Gets an array of string.static String[]getStringsEx(@Nullable Object[] objects, @Nullable Config config) Gets an array of String.static Viv.InstancemakeInstance(Object... parameters) Makes a class instance.static Viv.InstancemakeInstance(Object[] parameters, @Nullable Config config) Makes a class instance.static Viv.InstancemakeInstanceEx(Object... parameters) Makes a class instance.static Viv.InstancemakeInstanceEx(Object[] parameters, @Nullable Config config) Makes a class instance.static StringmakeString(@Nullable Object value) Convert a value into string.static StringmakeString(@Nullable Object value, @Nullable Config config) Converts a value into string.static Viv.ParsedParses VivJson's code and JSON object.static Viv.ParsedParses VivJson's code and JSON object.static Viv.ParsedParses VivJson's code and JSON object.static Viv.ParsedParses VivJson's code and JSON object.static Viv.ParsedParse a file that contains VivJson's code or JSON object.static Viv.ParsedparseFileEx(String filePath, @Nullable Config config) Parse a file that contains VivJson's code or JSON object.static Viv.ParsedParses a text that is VivJson's code or JSON object.static Viv.ParsedparseTextEx(String text, @Nullable Config config) Parses a text that is VivJson's code or JSON object.static voidprintStatements(Object statements) Prints statements.static voidprintStatements(Object statements, boolean addClassName, @Nullable Config config) Prints statements.static Viv.ResultRuns VivJson's code or deserialize JSON objects.static Viv.ResultRuns VivJson's code or deserialize JSON objects.static @Nullable ObjectRuns VivJson's code or deserialize JSON objects.static @Nullable ObjectRuns VivJson's code or deserialize JSON objects.
-
Constructor Details
-
Viv
public Viv()
-
-
Method Details
-
run
Runs VivJson's code or deserialize JSON objects.For example,
Viv.Result result = Viv.run("a:3,b:2,return(a+b)"); if (result.errorMessage.isEmpty()) { System.out.println((Long) result.value); // 5 } else { System.err.println(result.errorMessage); } // {"a": 3, "b": [2, 1]} result = Viv.run("{\"a\": 3, \"b\": [2, 1]}"); if (result.errorMessage.isEmpty()) { HashMap<String, @Nullable Object> map = (HashMap<String, @Nullable Object>) result.value; System.out.println(map.get("a")); // 3 ArrayList<@Nullable Object> list = (ArrayList<@Nullable Object>) map.get("b"); System.out.println(list.get(0)); // 2 } else { System.err.println(result.errorMessage); }Multiple arguments can be accepted as below.
- Viv.run("{a:3,b:2}", "return(a+b)"); // 5 - Viv.run("x=", "+", "{a:3,b:2}", "return(x.a+x.b)"); // 5 - Viv.run("test.viv"); - Viv.run("data.json", "calc.viv"); - Viv.run(new Viv.Json("{a:3,b:2}"), "calc.viv"); - ArrayList<Object> array = new ArrayList<>(); array.add(1); array.add(2); HashMap<String, Object> data = new HashMap<>(); data.put("x", array); data.put("y", true); // {"x":[1,2],"y":true} Viv.run(data,"return(if(y){:=x[0]}else{:=x[1]})"); // 1 - Config config = new Config(); config.enableStderr(); Viv.run("x/", config); // ErrorThe above examples are suitable if running times is only one. Otherwise, running after parsing is suitable. Parsing is done with
parse(Object...). Then the parsed statement is given as the argument of this method.
Alternatively,Viv.Parsed parsed = Viv.parse("return(a+b)"); Viv.Result result = Viv.run("{a:3,b:2}", parsed); System.out.println((Long) result.value); // 5 HashMap<String, Integer> variables = new HashMap<>(); variables.put("a", 5); variables.put("b", 7); result = Viv.run(variables, parsed); System.out.println((Long) result.value); // 12 variables.replace("b", 10); result = Viv.run(variables, parsed); System.out.println((Long) result.value); // 15makeInstance(Object...)is suitable. The example is described in the description ofmakeInstance(Object...).Note that the returned value is the following Java's Object.
-
Boolean -
Long -
Double -
String -
ArrayList<@Nullable Object> -
HashMap<String, @Nullable Object> -
null
@Nullable Object" of ArrayList/HashMap is also the above Object.- Parameters:
parameters- VivJson's codes, JSON values, file paths, variables, a Configuration, parsed statements, a class instance, a class member, or a calling class-method- A VivJson's code, a JSON value, or a file path is given as String.
- Some VivJson's codes, JSON values, file
paths, variables, or Parsed objects are
given as
ArrayList<Object>. - Some variables (name/value pairs) are
given as
HashMap<String, @Nullable Object>. - A JSON value is given as
Json. - Some configurations are given as
Config. - Some parsed statements that are generated
with
parse(Object...). - A class instance is given as
Instance. - A class member is given as the array of
Object (
Object[]).
For example,new Object[]{"foo", "bar"},"return(foo.bar)", and"return(foo['bar'])"are equivalent. Refer tomakeInstance(Object...). - A calling class-method is given as the
array of Object (
Object[]).
Its 1st element is the method name as String.
The following elements are its argument.
The arguments and the returned value isBoolean,Long,Double,String,ArrayList<@Nullable Object>,HashMap<String, @Nullable Object>, ornull. Refer tomakeInstance(Object...).
- Returns:
- result and Error message
- Member's variable
valuehas a result of the given codes or the deserialized JSON object if success,nullotherwise. - Member's variable
errorMessagehas "" if success, the error message otherwise.
- Member's variable
-
-
run
Runs VivJson's code or deserialize JSON objects.For example,
String[] strings = new String[] {"{a:3,b:2}", "return(a+b)"}; Viv.Result result = Viv.run(strings, null); if (result.errorMessage.isEmpty()) { System.out.println((Long) result.value); // 5 } else { System.err.println(result.errorMessage); } // {"a": 3, "b": [2, 1]} strings = new String[] {"{\"a\": 3, \"b\": [2, 1]}"}; result = Viv.run(strings, null); if (result.errorMessage.isEmpty()) { HashMap<String, @Nullable Object> map = (HashMap<String, @Nullable Object>) result.value; System.out.println(map.get("a")); // 3 ArrayList<@Nullable Object> list = (ArrayList<@Nullable Object>) map.get("b"); System.out.println(list.get(0)); // 2 } else { System.err.println(result.errorMessage); }Two arguments are needed. 1st argument is an array of Objects as below. 2nd argument is configuration.
nullis given as 2nd argument if configuration is not needed.- String[] statements = new String[] {"x=", "+", "{a:3,b:2}", "return(x.a+x.b)"}; Viv.run(statements, null); - String[] statements = new String[] {"test.viv"}; Viv.run(statements, null); - String[] statements = new String[] {"data.json", "calc.viv"}; Viv.run(statements, null); - Object[] statements = new Object[] {new Viv.Json("{a:3,b:2}"), "calc.viv"}; Viv.run(statements, null); - ArrayList<Integer> array = new ArrayList<>(); array.add(1); array.add(2); HashMap<String, Object> data = new HashMap<>(); data.put("x", array); data.put("y", true); // {"x":[1,2],"y":true} Object[] objects = new Object[] {data, "return(if(y){:=x[0]}else{:=x[1]})"}; Viv.run(objects, null); - String[] statements = new String[] {"x/"}; Config config = new Config(); config.enableStderr(); Viv.run(statements, config); // ErrorThe above examples are suitable if running times is only one. Otherwise, running after parsing is suitable. Parsing is done with
parse(Object[], Config). Then the parsed statement is given as the argument of this method.
Alternatively,String[] statements = new String[] {"a*=10,b+=1", "return(a+b)"}; Viv.Parsed parsed = Viv.parse(statements, null); Object[] objects = new Object[] {"{a:3,b:2}", parsed}; Viv.Result result = Viv.run(objects, null); System.out.println((Long) result.value); // 33 HashMap<String, Integer> variables = new HashMap<>(); variables.put("a", 5); variables.put("b", 7); objects[0] = variables; result = Viv.run(objects, null); System.out.println((Long) result.value); // 58 variables.replace("b", 10); result = Viv.run(objects, null); System.out.println((Long) result.value); // 61makeInstance(Object[], Config)is suitable. The example is described in the description ofmakeInstance(Object[], Config).Note that the returned value is the following Java's Object.
-
Boolean -
Long -
Double -
String -
ArrayList<@Nullable Object> -
HashMap<String, @Nullable Object> -
null
@Nullable Objectof ArrayList/HashMap is also the above Object.- Parameters:
parameters- VivJson's codes, JSON values, file paths, variables, parsed statements, a class instance, a class member, or a calling class-method- A VivJson's code, a JSON value, or a file path is given as String.
- Some VivJson's codes, JSON values, file
paths, variables, or Parsed objects are
given as
ArrayList<Object>. - Some variables (name/value pairs) are
given as
HashMap<String, @Nullable Object>. - A JSON value is given as
Json. - Some parsed statements that are generated
with
parse(Object[], Config). - A class instance is given as
Instance. - A class member is given as the array of
Object (
Object[]).
For example,new Object[]{"foo", "bar"},"return(foo.bar)", and"return(foo['bar'])"are equivalent. Refer tomakeInstance(Object[], Config). - A calling class-method is given as the
array of Object (
Object[]).
Its 1st element is the method name as String.
The following elements are its argument.
The arguments and the returned value isBoolean,Long,Double,String,ArrayList<@Nullable Object>,HashMap<String, @Nullable Object>, ornull. Refer tomakeInstance(Object[], Config).
config- configuration if it is needed,nullotherwise- Returns:
- result and Error message
- Member's variable
valuehas a result of the given codes or the deserialized JSON object if success,nullotherwise. - Member's variable
errorMessagehas "" if success, the error message otherwise.
- Member's variable
-
-
runEx
Runs VivJson's code or deserialize JSON objects. (Permit exception)For example,
try { Object result = Viv.runEx("a:3,b:2,return(a+b)"); System.out.println((Long) result); // 5 } catch (VivException e) { System.err.println(e.getMessage()); } try { // {"a": 3, "b": [2, 1]} Object result = Viv.runEx("{\"a\": 3, \"b\": [2, 1]}"); HashMap<String, @Nullable Object> map = (HashMap<String, @Nullable Object>) result; System.out.println(map.get("a")); // 3 ArrayList<@Nullable Object> list = (ArrayList<@Nullable Object>) map.get("b"); System.out.println(list.get(0)); // 2 } catch (VivException e) { System.err.println(e.getMessage()); }The detail of the argument and the returned value is described in
run(Object...).parseEx(Object...)ormakeInstanceEx(Object...)may be useful if you access member's value/method sometimes.- Parameters:
parameters- VivJson's codes, JSON values, file paths, variables, a Configuration, parsed statements, a class instance, a class member, or a calling class-method- A VivJson's code, a JSON value, or a file path is given as String.
- Some VivJson's codes, JSON values, file
paths, variables, or Parsed objects are
given as
ArrayList<Object>. - Some variables (name/value pairs) are
given as
HashMap<String, @Nullable Object>. - A JSON value is given as
Json. - a configuration is given as
Config. - Some parsed statements that are generated
with
parseEx(Object...). - A class instance is given as
Instance. - A class member is given as the array of
Object (
Object[]).
For example,new Object[]{"foo", "bar"},"return(foo.bar)", and"return(foo['bar'])"are equivalent. Refer tomakeInstanceEx(Object...). - A calling class-method is given as the
array of Object (
Object[]).
Its 1st element is the method name as String.
The following elements are its argument.
The arguments and the returned value isBoolean,Long,Double,String,ArrayList<@Nullable Object>,HashMap<String, @Nullable Object>, ornull. Refer tomakeInstanceEx(Object...).
- Returns:
- a result of the given codes if success,
nullotherwise - Throws:
VivException- it is thrown if parsing or evaluation is failed.
-
runEx
public static @Nullable Object runEx(Object[] parameters, @Nullable Config config) throws VivException Runs VivJson's code or deserialize JSON objects. (Permit exception)For example,
String[] strings = new String[] {"{a:3,b:2}", "return(a+b)"}; try { Object result = Viv.runEx(strings, null); System.out.println((Long) result); // 5 } catch (VivException e) { System.err.println(e.getMessage()); } // {"a": 3, "b": [2, 1]} strings = new String[] {"{\"a\": 3, \"b\": [2, 1]}"}; try { Object result = Viv.runEx(strings, null); HashMap<String, @Nullable Object> map = (HashMap<String, @Nullable Object>) result; System.out.println(map.get("a")); // 3 ArrayList<@Nullable Object> list = (ArrayList<@Nullable Object>) map.get("b"); System.out.println(list.get(0)); // 2 } catch (VivException e) { System.err.println(e.getMessage()); }The detail of the argument and the returned value is described in
run(Object[], Config).parseEx(Object[], Config)ormakeInstanceEx(Object[], Config)may be useful if you access member's value/method sometimes.- Parameters:
parameters- VivJson's codes, JSON values, file paths, variables, parsed statements, a class instance, a class member, or a calling class-method- A VivJson's code, a JSON value, or a file path is given as String.
- Some VivJson's codes, JSON values, file
paths, variables, or Parsed objects are
given as
ArrayList<Object>. - Some variables (name/value pairs) are
given as
HashMap<String, @Nullable Object>. - A JSON value is given as
Json. - Some parsed statements that are generated
with
parseEx(Object[], Config). - A class instance is given as
Instance. - A class member is given as the array of
Object (
Object[]).
For example,new Object[]{"foo", "bar"},"return(foo.bar)", and"return(foo['bar'])"are equivalent. Refer tomakeInstanceEx(Object[], Config). - A calling class-method is given as the
array of Object (
Object[]).
Its 1st element is the method name as String.
The following elements are its argument.
The arguments and the returned value isBoolean,Long,Double,String,ArrayList<@Nullable Object>,HashMap<String, @Nullable Object>, ornull. Refer tomakeInstanceEx(Object[], Config).
config- configuration if it is needed,nullotherwise- Returns:
- a result of the given codes if success,
nullotherwise - Throws:
VivException- it is thrown if parsing or evaluation is failed.
-
parse
Parses VivJson's code and JSON object.For example,
Viv.Parsed parsed = Viv.parse("return(a+b)"); Viv.Result result = Viv.run("{a:3,b:2}", parsed); System.out.println((Long) result.value); // 5Multiple arguments can be accepted as below.
- Viv.parse("x=", "+", "{a:3,b:2}", "return(x.a+x.b)"); - Viv.parse("test.viv"); - Viv.parse("data.json", "calc.viv"); - Viv.parse(new Viv.Json("{a:3,b:2}"), "calc.viv"); - ArrayList<Integer> array = new ArrayList<>(); array.add(1); array.add(2); HashMap<String, Object> data = new HashMap<>(); data.put("x", array); data.put("y", true); // {"x":[1,2],"y":true} Viv.parse(data,"return(if(y){:=x[0]}else{:=x[1]})"); - Config config = new Config(); config.enableStderr(); Viv.parse("x/", config); // Error- Parameters:
parameters- VivJson's codes, JSON values, file paths, variables, a Configuration, parsed statements, a class instance, a class member, or a calling class-method- A VivJson's code, a JSON value, or a file path is given as String.
- Some VivJson's codes, JSON values, file
paths, variables, or Parsed objects are
given as
ArrayList<Object>. - Some variables (name/value pairs) are
given as
HashMap<String, @Nullable Object>. - A JSON value is given as
Json. - Some configurations are given as
Config. - Some parsed statements (
Parsed) that are generated with this method. It is passed through toward output. - A class instance (
Instance) that is generated withmakeInstance(Object...). It is passed through toward output. - A class member is given as the array of
Object (
Object[]).
For example,new Object[]{"foo", "bar"},"return(foo.bar)", and"return(foo['bar'])"are equivalent. Refer tomakeInstance(Object...). - A calling class-method is given as the
array of Object (
Object[]).
Its 1st element is the method name as String.
The following elements are its argument.
The arguments and the returned value isBoolean,Long,Double,String,ArrayList<@Nullable Object>,HashMap<String, @Nullable Object>, ornull. Refer tomakeInstance(Object...).
- Returns:
- statements of script and Error message
- Member's variable
statementshas statements of the given codes if success,nullotherwise. - Member's variable
errorMessagehas "" if success, the error message otherwise.
- Member's variable
-
parse
Parses VivJson's code and JSON object.For example,
String[] statements = new String[] {"a*=10,b+=1", "return(a+b)"}; Viv.Parsed parsed = Viv.parse(statements, null); { Viv.Result result = Viv.run("{a:3,b:2}", parsed); System.out.println((Long) result.value); // 33 } { Object[] objects = new Object[] {"{a:3,b:2}", parsed}; Viv.Result result = Viv.run(objects, null); System.out.println((Long) result.value); // 33 }Two arguments are needed. 1st argument is an array of Objects as below. 2nd argument is configuration.
nullis given as 2nd argument if configuration is not needed.
For example,- String[] statements = new String[] {"{a:3,b:2}", "{return(a+b)}"}; Viv.parse(statements, null); - String[] statements = new String[] {"x=", "+", "{a:3,b:2}", "return(x.a+x.b)"}; Viv.parse(statements, null); - String[] statements = new String[] {"test.viv"}; Viv.parse(statements, null); - String[] statements = new String[] {"data.json", "calc.viv"}; Viv.parse(statements, null); - Object[] statements = new Object[] {new Viv.Json("{a:3,b:2}"), "calc.viv"}; Viv.parse(statements, null); - ArrayList<Integer> array = new ArrayList<>(); array.add(1); array.add(2); HashMap<String, Object> data = new HashMap<>(); data.put("x", array); data.put("y", true); // {"x":[1,2],"y":true} Object[] objects = new Object[] {data, "return(if(y){:=x[0]}else{:=x[1]})"}; Viv.parse(objects, null); - String[] statements = new String[] {"x/"}; Config config = new Config(); config.enableStderr(); Viv.parse(statements, config); // Error- Parameters:
parameters- VivJson's codes, JSON values, file paths, variables, parsed statements, a class instance, a class member, or a calling class-method- A VivJson's code, a JSON value, or a file path is given as String.
- Some VivJson's codes, JSON values, file
paths, variables, or Parsed objects are
given as
ArrayList<Object>. - Some variables (name/value pairs) are
given as
HashMap<String, @Nullable Object>. - A JSON value is given as
Json. - Some parsed statements (
Parsed) that are generated with this method. It is passed through toward output. - A class instance (
Instance) that is generated withmakeInstance(Object[], Config). It is passed through toward output. - A class member is given as the array of
Object (
Object[]).
For example,new Object[]{"foo", "bar"},"return(foo.bar)", and"return(foo['bar'])"are equivalent. Refer tomakeInstance(Object[], Config). - A calling class-method is given as the
array of Object (
Object[]).
Its 1st element is the method name as String.
The following elements are its argument.
The arguments and the returned value isBoolean,Long,Double,String,ArrayList<@Nullable Object>,HashMap<String, @Nullable Object>, ornull. Refer tomakeInstance(Object[], Config).
config- configuration if it is needed,nullotherwise- Returns:
- statements of script and Error message
- Member's variable
statementshas statements of the given codes if success,nullotherwise. - Member's variable
errorMessagehas "" if success, the error message otherwise.
- Member's variable
-
parseEx
Parses VivJson's code and JSON object. (Permit exception)For example,
try { Viv.Parsed parsed = Viv.parseEx("return(a+b)"); Object result = Viv.runEx("{a:3,b:2}", parsed); System.out.println((Long) result); // 5 } catch (VivException e) { System.err.println(e.getMessage()); }The detail of the argument and the returned value is described in
parse(Object...).- Parameters:
parameters- VivJson's codes, JSON values, file paths, variables, a Configuration, parsed statements, a class instance, a class member, or a calling class-method- A VivJson's code, a JSON value, or a file path is given as String.
- Some VivJson's codes, JSON values, file
paths, variables, or Parsed objects are
given as
ArrayList<Object>. - Some variables (name/value pairs) are
given as
HashMap<String, @Nullable Object>. - A JSON value is given as
Json. - Some configurations are given as
Config. - Some parsed statements (
Parsed) that are generated with this method. It is passed through toward output. - A class instance (
Instance) that is generated withmakeInstanceEx(Object...). It is passed through toward output. - A class member is given as the array of
Object (
Object[]).
For example,new Object[]{"foo", "bar"},"return(foo.bar)", and"return(foo['bar'])"are equivalent. Refer tomakeInstanceEx(Object...). - A calling class-method is given as the
array of Object (
Object[]).
Its 1st element is the method name as String.
The following elements are its argument.
The arguments and the returned value isBoolean,Long,Double,String,ArrayList<@Nullable Object>,HashMap<String, @Nullable Object>, ornull. Refer tomakeInstanceEx(Object...).
- Returns:
- statements of script and Error message
- Member's variable
statementshas statements of the given codes if success,nullotherwise. - Member's variable
errorMessagehas "" if success, the error message otherwise.
- Member's variable
- Throws:
VivException- it is thrown if parsing is failed.
-
parseEx
Parses VivJson's code and JSON object. (Permit exception)For example,
String[] statements = new String[] {"a*=10,b+=1", "return(a+b)"}; try { Viv.Parsed parsed = Viv.parseEx(statements, null); { Object result = Viv.runEx("{a:3,b:2}", parsed); System.out.println((Long) result); // 33 } { Object[] objects = new Object[] {"{a:3,b:2}", parsed}; Object result = Viv.runEx(objects, null); System.out.println((Long) result); // 33 } } catch (VivException e) { System.err.println(e.getMessage()); }The detail of the argument and the returned value is described in
parse(Object[], Config).- Parameters:
parameters- VivJson's codes, JSON values, file paths, variables, parsed statements, a class instance, a class member, or a calling class-method- A VivJson's code, a JSON value, or a file path is given as String.
- Some VivJson's codes, JSON values, file
paths, variables, or Parsed objects are
given as
ArrayList<Object>. - Some variables (name/value pairs) are
given as
HashMap<String, @Nullable Object>. - A JSON value is given as
Json. - Some parsed statements (
Parsed) that are generated with this method. It is passed through toward output. - A class instance (
Instance) that is generated withmakeInstanceEx(Object[], Config). It is passed through toward output. - A class member is given as the array of
Object (
Object[]).
For example,new Object[]{"foo", "bar"},"return(foo.bar)", and"return(foo['bar'])"are equivalent. Refer tomakeInstanceEx(Object[], Config). - A calling class-method is given as the
array of Object (
Object[]).
Its 1st element is the method name as String.
The following elements are its argument.
The arguments and the returned value isBoolean,Long,Double,String,ArrayList<@Nullable Object>,HashMap<String, @Nullable Object>, ornull. Refer tomakeInstanceEx(Object[], Config).
config- configuration if it is needed,nullotherwise- Returns:
- statements of script and Error message
- Member's variable
statementshas statements of the given codes if success,nullotherwise. - Member's variable
errorMessagehas "" if success, the error message otherwise.
- Member's variable
- Throws:
VivException- it is thrown if parsing is failed.
-
parseFile
Parse a file that contains VivJson's code or JSON object. When the file extension is "json", only JSON value is allowed as contents.- Parameters:
filePath- the path of file that has VivJson's code or JSON objectconfig- configuration if needed,nullotherwise- Returns:
- statements of script and Error message
- Member's variable
statementshas statements of the given codes if success,nullotherwise. - Member's variable
errorMessagehas "" if success, the error message otherwise.
- Member's variable
-
parseFileEx
Parse a file that contains VivJson's code or JSON object. (Permit exception)- Parameters:
filePath- the path of file that has VivJson's code or JSON objectconfig- configuration if needed,nullotherwise- Returns:
- statements of script and Error message
- Member's variable
statementshas statements of the given codes if success,nullotherwise. - Member's variable
errorMessagehas "" if success, the error message otherwise.
- Member's variable
- Throws:
VivException- it is thrown if parsing is failed.
-
parseText
Parses a text that is VivJson's code or JSON object.- Parameters:
text- text that is VivJson's code or JSON objectconfig- configuration if needed,nullotherwise- Returns:
- statements of script and Error message
- Member's variable
statementshas statements of the given codes if success,nullotherwise. - Member's variable
errorMessagehas "" if success, the error message otherwise.
- Member's variable
-
parseTextEx
Parses a text that is VivJson's code or JSON object. (Permit exception)- Parameters:
text- text that is VivJson's code or JSON objectconfig- configuration if needed,nullotherwise- Returns:
- statements of script and Error message
- Member's variable
statementshas statements of the given codes if success,nullotherwise. - Member's variable
errorMessagehas "" if success, the error message otherwise.
- Member's variable
- Throws:
VivException- it is thrown if parsing is failed.
-
makeInstance
Makes a class instance. This method runs the given parameters as Constructor. Then its result will be class instance.For example, JSON object's member is extracted as below.
// {"a": [10, {"b": null, "c": "test"}], "d": {"e": 3.5}} Viv.Instance instance = Viv.makeInstance( "{\"a\": [10, {\"b\": null, \"c\": \"test\"}], \"d\": {\"e\": 3.5}}"); try { System.out.println( Viv.runEx(instance, new Object[]{"a",1,"c"})); // "test" System.out.println( Viv.runEx(instance, "return(d.e)")); // 3.5 } catch (VivException e) { System.err.println(e.getMessage()); }new Object[]{"foo", "bar"},"return(foo.bar)", and"return(foo['bar'])"are equivalent.
The valid element of the above Object's array is integer or String. The each hierarchy of JSON object/array is decomposed into the array.Array, boolean, number, or string can be accessed via the implicit variable "_".
When there are some values,Viv.Instance instance = Viv.makeInstance("100"); try { System.out.println(Viv.runEx(instance, new Object[]{"_"})); // 100 System.out.println(Viv.runEx(instance, "return(_)")); // 100 } catch (VivException e) { System.err.println(e.getMessage()); }_[0], _[1], ...are assigned.// true, false, null, "text", 100L, 1.0 Viv.Instance instance = Viv.makeInstance( "true", "false", "null", "text", "100", "1.0"); try { Object[] variable = new Object[] {"_", null}; for (int i = 0; i < 6; i++) { variable[1] = i; System.out.println(Viv.runEx(instance, variable)); System.out.println(Viv.runEx(instance, "return(_[" + i + "])")); } } catch (VivException e) { System.err.println(e.getMessage()); }
Note that the negative index is used for backward access in array.// ["a", 10, [{"b": null, "c": "test"}, false]] Viv.Instance instance = Viv.makeInstance( "[\"a\", 10, [{\"b\": null, \"c\": \"test\"}, false]]"); try { System.out.println( Viv.runEx(instance, new Object[]{"_", 2, 0, "b"})); // null System.out.println( Viv.runEx(instance, "return(_[2][0]['b'])")); // null System.out.println( Viv.runEx(instance, new Object[]{"_", 2, -2, "c"})); // "test" System.out.println( Viv.runEx(instance, "return(_.2.-2.c)")); // "test" } catch (VivException e) { System.err.println(e.getMessage()); }When whole extracted value is needed,
Viv.runorViv.runExis used without this method.try { // {"a": [10, {"b": null, "c": "test"}], "d": {"e": 3.5}} Object result = Viv.runEx( "{\"a\": [10, {\"b\": null, \"c\": \"test\"}], \"d\": {\"e\": 3.5}}"); HashMap<String, @Nullable Object> value = (HashMap<String, @Nullable Object>) result; ArrayList<@Nullable Object> array = (ArrayList<@Nullable Object>) value.get("a"); System.out.println(array.get(0)); // 10 } catch (VivException e) { System.err.println(e.getMessage()); }Note that the returned value is the following Java's Object.
-
Boolean -
Long -
Double -
String -
ArrayList<@Nullable Object> -
HashMap<String, @Nullable Object> -
null
@Nullable Object" of ArrayList/HashMap is also the above Object.The above "return()", the following "c = a * b, return(c)", and so on are the additional anonymous function.
// {"a": 3, "b": 2} Viv.Instance instance = Viv.makeInstance("{\"a\": 3, \"b\": 2}"); try { System.out.println(Viv.runEx(instance, "return(a)")); // 3 System.out.println(Viv.runEx(instance, "return(a + b)")); // 5 // Local variable "c" is created. However it is lost after running task. System.out.println(Viv.runEx(instance, "c = a * b, return(c)")); // 6 System.out.println(Viv.runEx(instance, "return(c)")); // null ("c" is missing.) // Class member "a" is rewritten. So it is remained after running task. System.out.println(Viv.runEx(instance, "a += 100, return(a)")); // 103 System.out.println(Viv.runEx(instance, "return(a)")); // 103 } catch (VivException e) { System.err.println(e.getMessage()); }The class-method can be called as below.
The 1st element of the given array is the method name as String.String code = "function test(x, y) {" + " z = x.a + x.b.1 + y" + " return(z)" + "}"; // {"a": 100, "b": [1.0, 2.0]} ArrayList<Double> list = new ArrayList<>(); list.add(1.0); list.add(2.0); HashMap<String, Object> map = new HashMap<>(); map.put("a", 100); map.put("b", list); Viv.Instance instance = Viv.makeInstance(code); try { Object result = Viv.runEx(instance, new Object[] {"test", map, 3}); System.out.println(result); // 105.0 } catch (VivException e) { System.err.println(e.getMessage()); }
The following elements are its argument.
The arguments and the returned value is the above Java's Object.
In arguments ofrun(Object...)andrunEx(Object...), instance object must be given before the array of Object (Object[]).- Parameters:
parameters- VivJson's codes, JSON values, file paths, variables, a Configuration, or the parsed statement- A VivJson's code, a JSON value, or a file path is given as String.
- Some VivJson's codes, JSON values, file
paths, variables, or Parsed objects are
given as
ArrayList<Object>. - Some variables (name/value pairs) are
given as
HashMap<String, @Nullable Object>. - A JSON value is given as
Json. - Configuration is given as
Config. - The parsed statement that is generated
with
parse(Object...).
- Returns:
- a class instance and Error message
- Member's variable
evaluatorhas a class instance if success,nullotherwise. - Member's variable
errorMessagehas "" if success, the error message otherwise.
- Member's variable
-
-
makeInstance
Makes a class instance. This method runs the given parameters as Constructor. Then its result will be class instance.For example, JSON object's member is extracted as below.
// {"a": [10, {"b": null, "c": "test"}], "d": {"e": 3.5}} String[] strings = new String[] { "{\"a\": [10, {\"b\": null, \"c\": \"test\"}], \"d\": {\"e\": 3.5}}"}; Viv.Instance instance = Viv.makeInstance(strings, null); try { System.out.println( Viv.runEx(instance, new Object[]{"a",1,"c"})); // "test" System.out.println( Viv.runEx(instance, "return(d.e)")); // 3.5 } catch (VivException e) { System.err.println(e.getMessage()); }new Object[]{"foo", "bar"},"return(foo.bar)", and"return(foo['bar'])"are equivalent.
The valid element of the above Object's array is integer or String. The each hierarchy of JSON object/array is decomposed into the array.Array, boolean, number, or string can be accessed via the implicit variable "_".
When there are some values,String[] strings = new String[] {"100"}; Viv.Instance instance = Viv.makeInstance(strings, null); try { System.out.println(Viv.runEx(instance, new Object[]{"_"})); // 100 System.out.println(Viv.runEx(instance, "return(_)")); // 100 } catch (VivException e) { System.err.println(e.getMessage()); }_[0], _[1], ...are assigned.// true, false, null, "text", 100L, 1.0 String[] strings = new String[] {"true", "false", "null", "text", "100", "1.0"}; Viv.Instance instance = Viv.makeInstance(strings, null); try { Object[] variable = new Object[] {"_", null}; for (int i = 0; i < 6; i++) { variable[1] = i; System.out.println(Viv.runEx(instance, variable)); System.out.println(Viv.runEx(instance, "return(_[" + i + "])")); } } catch (VivException e) { System.err.println(e.getMessage()); }
Note that the negative index is used for backward access in array.// ["a", 10, [{"b": null, "c": "test"}, false]] String[] strings = new String[] {"[\"a\", 10, [{\"b\": null, \"c\": \"test\"}, false]]"}; Viv.Instance instance = Viv.makeInstance(strings, null); try { System.out.println( Viv.runEx(instance, new Object[]{"_", 2, 0, "b"})); // null System.out.println( Viv.runEx(instance, "return(_[2][0]['b'])")); // null System.out.println( Viv.runEx(instance, new Object[]{"_", 2, -2, "c"})); // "test" System.out.println( Viv.runEx(instance, "return(_.2.-2.c)")); // "test" } catch (VivException e) { System.err.println(e.getMessage()); }When whole extracted value is needed,
Viv.runorViv.runExis used without this method.// {"a": [10, {"b": null, "c": "test"}], "d": {"e": 3.5}} String[] strings = new String[] { "{\"a\": [10, {\"b\": null, \"c\": \"test\"}], \"d\": {\"e\": 3.5}}"}; try { Object result = Viv.runEx(strings, null); HashMap<String, @Nullable Object> value = (HashMap<String, @Nullable Object>) result; ArrayList<@Nullable Object> array = (ArrayList<@Nullable Object>) value.get("a"); System.out.println(array.get(0)); // 10 } catch (VivException e) { System.err.println(e.getMessage()); }Note that the returned value is the following Java's Object.
-
Boolean -
Long -
Double -
String -
ArrayList<@Nullable Object> -
HashMap<String, @Nullable Object> -
null
@Nullable Object" of ArrayList/HashMap is also the above Object.The above "return()", the following "c = a * b, return(c)", and so on are the additional anonymous function.
// {"a": 3, "b": 2} String[] strings = new String[] {"{\"a\": 3, \"b\": 2}"}; Viv.Instance instance = Viv.makeInstance(strings, null); try { System.out.println(Viv.runEx(instance, "return(a)")); // 3 System.out.println(Viv.runEx(instance, "return(a + b)")); // 5 // Local variable "c" is created. However it is lost after running task. System.out.println(Viv.runEx(instance, "c = a * b, return(c)")); // 6 System.out.println(Viv.runEx(instance, "return(c)")); // null ("c" is missing.) // Class member "a" is rewritten. So it is remained after running task. System.out.println(Viv.runEx(instance, "a += 100, return(a)")); // 103 System.out.println(Viv.runEx(instance, "return(a)")); // 103 } catch (VivException e) { System.err.println(e.getMessage()); }The class-method can be called as below.
The 1st element of the given array is the method name as String.String[] codes = new String[] { "function add3(x, y, z) {return(x + y + z)}", "function test(x, y) {return(add3(x.a, x.b.1, y))}" }; // {"a": 100, "b": [1.0, 2.0]} ArrayList<Double> list = new ArrayList<>(); list.add(1.0); list.add(2.0); HashMap<String, Object> map = new HashMap<>(); map.put("a", 100); map.put("b", list); Viv.Instance instance = Viv.makeInstance(codes, null); try { Object result = Viv.runEx(instance, new Object[] {"test", map, 3}); System.out.println(result); // 105.0 } catch (VivException e) { System.err.println(e.getMessage()); }
The following elements are its argument.
The arguments and the returned value is the above Java's Object.
In arguments ofrun(Object[], Config)andrun(Object[], Config), instance object must be given before the array of Object (Object[]).- Parameters:
parameters- VivJson's codes, JSON values, file paths, variables, or the parsed statement- A VivJson's code, a JSON value, or a file path is given as String.
- Some VivJson's codes, JSON values, file
paths, variables, or Parsed objects are
given as
ArrayList<Object>. - Some variables (name/value pairs) are
given as
HashMap<String, @Nullable Object>. - A JSON value is given as
Json. - The parsed statement that is generated
with
parse(Object[], Config).
config- configuration if needed,nullotherwise- Returns:
- a class instance and Error message
- Member's variable
evaluatorhas a class instance if success,nullotherwise. - Member's variable
errorMessagehas "" if success, the error message otherwise.
- Member's variable
-
-
makeInstanceEx
Makes a class instance. (Permit exception) This method runs the given parameters as Constructor. Then its result will be class instance.For example, JSON object's member is extracted as below.
try { // {"a": [10, {"b": null, "c": "test"}], "d": {"e": 3.5}} Viv.Instance instance = Viv.makeInstanceEx( "{\"a\": [10, {\"b\": null, \"c\": \"test\"}], \"d\": {\"e\": 3.5}}"); System.out.println( Viv.runEx(instance, new Object[]{"a",1,"c"})); // "test" System.out.println( Viv.runEx(instance, "return(d.e)")); // 3.5 } catch (VivException e) { System.err.println(e.getMessage()); }new Object[]{"foo", "bar"},"return(foo.bar)", and"return(foo['bar'])"are equivalent.
The valid element of the above Object's array is integer or String. The each hierarchy of JSON object/array is decomposed into the array.The class-method can be called as below.
The 1st element of the given array is the method name as String.String code = "function test(x, y) {" + " z = x.a + x.b.1 + y" + " return(z)" + "}"; // {"a": 100, "b": [1.0, 2.0]} ArrayList<Double> list = new ArrayList<>(); list.add(1.0); list.add(2.0); HashMap<String, Object> map = new HashMap<>(); map.put("a", 100); map.put("b", list); try { Viv.Instance instance = Viv.makeInstanceEx(code); Object result = Viv.runEx(instance, new Object[] {"test", map, 3}); System.out.println(result); // 105.0 } catch (VivException e) { System.err.println(e.getMessage()); }
The following elements are its argument.
The arguments and the returned value is the above Java's Object.
In arguments ofrun(Object...)andrunEx(Object...), instance object must be given before the array of Object (Object[]).The detail of the argument and the returned value is described in
makeInstance(Object...).- Parameters:
parameters- VivJson's codes, JSON values, file paths, variables, a Configuration, or the parsed statement- A VivJson's code, a JSON value, or a file path is given as String.
- Some VivJson's codes, JSON values, file
paths, variables, or Parsed objects are
given as
ArrayList<Object>. - Some variables (name/value pairs) are
given as
HashMap<String, @Nullable Object>. - A JSON value is given as
Json. - Configuration is given as
Config. - The parsed statement that is generated
with
parse(Object...).
- Returns:
- a class instance and Error message
- Member's variable
evaluatorhas a class instance if success,nullotherwise. - Member's variable
errorMessagehas "" if success, the error message otherwise.
- Member's variable
- Throws:
VivException- it is thrown if making is failed.
-
makeInstanceEx
public static Viv.Instance makeInstanceEx(Object[] parameters, @Nullable Config config) throws VivException Makes a class instance. (Permit exception) This method runs the given parameters as Constructor. Then its result will be class instance.For example, JSON object's member is extracted as below.
// {"a": [10, {"b": null, "c": "test"}], "d": {"e": 3.5}} String[] strings = new String[] { "{\"a\": [10, {\"b\": null, \"c\": \"test\"}], \"d\": {\"e\": 3.5}}"}; try { Viv.Instance instance = Viv.makeInstanceEx(strings, null); System.out.println( Viv.runEx(instance, new Object[]{"a",1,"c"})); // "test" System.out.println( Viv.runEx(instance, "return(d.e)")); // 3.5 } catch (VivException e) { System.err.println(e.getMessage()); }new Object[]{"foo", "bar"},"return(foo.bar)", and"return(foo['bar'])"are equivalent.
The valid element of the above Object's array is integer or String. The each hierarchy of JSON object/array is decomposed into the array.The class-method can be called as below.
The 1st element of the given array is the method name as String.String[] codes = new String[] { "function add3(x, y, z) {return(x + y + z)}", "function test(x, y) {return(add3(x.a, x.b.1, y))}" }; // {"a": 100, "b": [1.0, 2.0]} ArrayList<Double> list = new ArrayList<>(); list.add(1.0); list.add(2.0); HashMap<String, Object> map = new HashMap<>(); map.put("a", 100); map.put("b", list); try { Viv.Instance instance = Viv.makeInstanceEx(codes, null); Object result = Viv.runEx(instance, new Object[] {"test", map, 3}); System.out.println(result); // 105.0 } catch (VivException e) { System.err.println(e.getMessage()); }
The following elements are its argument.
The arguments and the returned value is the above Java's Object..
In arguments ofrun(Object[], Config)andrun(Object[], Config), instance object must be given before the array of Object (Object[]).The detail of the argument and the returned value is described in
makeInstance(Object[], Config).- Parameters:
parameters- VivJson's codes, JSON values, file paths, variables, or the parsed statement- A VivJson's code, a JSON value, or a file path is given as String.
- Some VivJson's codes, JSON values, file
paths, variables, or Parsed objects are
given as
ArrayList<Object>. - Some variables (name/value pairs) are
given as
HashMap<String, @Nullable Object>. - A JSON value is given as
Json. - The parsed statement that is generated
with
parse(Object[], Config).
config- configuration if needed,nullotherwise- Returns:
- a class instance and Error message
- Member's variable
evaluatorhas a class instance if success,nullotherwise. - Member's variable
errorMessagehas "" if success, the error message otherwise.
- Member's variable
- Throws:
VivException- it is thrown if making is failed.
-
printStatements
Prints statements.- Parameters:
statements- statements of script.Parsed,Block, orArrayList<Statement>.
-
printStatements
public static void printStatements(Object statements, boolean addClassName, @Nullable Config config) Prints statements.- Parameters:
statements- statements of script.Parsed,Block, orArrayList<Statement>.addClassName- Class name is added to each statement if this is true.config- configuration if needed,nullotherwise
-
getBoolean
Gets a boolean.When the entity of the object is expected as boolean, it can be converted with this method.
However, if the evaluated result is not boolean,nullis returned.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare Boolean src = true; Object obj = src; // Example Boolean value = Viv.getBoolean(obj);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("a=2", "return(a==2)"); // Example Boolean value = Viv.getBoolean(result);The same arguments of
Viv.runandViv.runExcan be given.Boolean value = Viv.getBoolean("a=2", "return(a==2)");- Parameters:
objects- object that may be a boolean value- Returns:
- a boolean value.
nullif evaluation is failed or the evaluated result is not boolean. - See Also:
-
getBoolean
Gets a boolean.When the entity of the object is expected as boolean, it can be converted with this method.
However, if the evaluated result is not boolean,nullis returned.- Parameters:
objects- object that may be a boolean valueconfig- configuration if it is needed,nullotherwise- Returns:
- a boolean value.
nullif evaluation is failed or the evaluated result is not boolean. - See Also:
-
getBooleanEx
Gets a boolean. (Permit exception)When the entity of the object is expected as boolean, it can be converted with this method.
However, if the evaluated result is not boolean, the exception is thrown.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare Boolean src = true; Object obj = src; // Example boolean value = Viv.getBooleanEx(obj);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("a=2", "return(a==2)"); // Example boolean value = Viv.getBooleanEx(object);The same arguments of
Viv.runandViv.runExcan be given.boolean value = Viv.getBooleanEx("a=2", "return(a==2)");- Parameters:
objects- object that may be a boolean value- Returns:
- a boolean value
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not boolean.- See Also:
-
getBooleanEx
public static boolean getBooleanEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets a boolean. (Permit exception)When the entity of the object is expected as boolean, it can be converted with this method.
However, if the evaluated result is not boolean, the exception is thrown.- Parameters:
objects- object that may be a boolean valueconfig- configuration if it is needed,nullotherwise- Returns:
- a boolean value
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not boolean.- See Also:
-
getBooleans
Gets an array of boolean.When the entity of the object is expected as an array of boolean, it can be converted with this method.
However, if there is invalid element, such as integer,nullis returned.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(true); array.add(false); array.add(true); // Example boolean[] booleans = Viv.getBooleans(array);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return([true, false])"); // Example boolean[] booleans = Viv.getBooleans(result);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not boolean, this method returns
null.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.boolean[] booleans = Viv.getBooleans("{\"a\": true, \"b\": false}");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of boolean.
nullif evaluation is failed or the evaluated result is not an array of boolean. - See Also:
-
getBooleans
Gets an array of boolean.When the entity of the object is expected as an array of boolean, it can be converted with this method.
However, if there is invalid element, such as integer,nullis returned.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not boolean, this method returns
null.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of boolean.
nullif evaluation is failed or the evaluated result is not an array of boolean. - See Also:
-
getBooleansEx
Gets an array of boolean. (Permit exception)When the entity of the object is expected as an array of boolean, it can be converted with this method.
However, if there is invalid element, such as integer, the exception is thrown.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(true); array.add(false); array.add(true); // Example boolean[] booleans = Viv.getBooleansEx(array);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return([true, false])"); // Example boolean[] booleans = Viv.getBooleansEx(object);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not boolean, this method throws the exception.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.boolean[] booleans = Viv.getBooleansEx("{\"a\": true, \"b\": false}");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of boolean
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of boolean.- See Also:
-
getBooleansEx
public static boolean[] getBooleansEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets an array of boolean. (Permit exception)When the entity of the object is expected as an array of boolean, it can be converted with this method.
However, if there is invalid element, such as integer, the exception is thrown.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not boolean, this method throws the exception.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of boolean
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of boolean.- See Also:
-
getBooleanOrNulls
Gets an array of boolean.When the entity of the object is expected as an array of boolean, it can be converted with this method.
Even if there is invalid element, such as integer, it will be replaced withnull.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(true); array.add(0); array.add(false); // Example Boolean[] booleans = Viv.getBooleans(array);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return([true, 0])"); // Example Boolean[] booleans = Viv.getBooleans(result);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method returns
null.
Even if there is invalid value, such as integer, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.Boolean[] booleans = Viv.getBooleans("{\"a\": true, \"b\": 0}");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of boolean/
null.nullif evaluation is failed or the evaluated result is not an array of boolean. - See Also:
-
getBooleanOrNulls
public static @Nullable Boolean @Nullable [] getBooleanOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets an array of boolean.When the entity of the object is expected as an array of boolean, it can be converted with this method.
Even if there is invalid element, such as integer, it will be replaced withnull.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method returns
null.
Even if there is invalid value, such as integer, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of boolean/
null.nullif evaluation is failed or the evaluated result is not an array of boolean. - See Also:
-
getBooleanOrNullsEx
public static @Nullable Boolean[] getBooleanOrNullsEx(@Nullable Object... objects) throws VivException Gets an array of boolean. (Permit exception)When the entity of the object is expected as an array of boolean, it can be converted with this method.
Even if there is invalid element, such as integer, it will be replaced withnull.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(true); array.add(0); array.add(false); // Example Boolean[] booleans = Viv.getBooleanOrNullsEx(array);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return([true, 0])"); // Example Boolean[] booleans = Viv.getBooleanOrNullsEx(object);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method throws the exception.
Even if there is invalid value, such as integer, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.Boolean[] booleans = Viv.getBooleanOrNullsEx("{\"a\": true, \"b\": 0}");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of boolean/
null - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of boolean.- See Also:
-
getBooleanOrNullsEx
public static @Nullable Boolean[] getBooleanOrNullsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets an array of boolean. (Permit exception)When the entity of the object is expected as an array of boolean, it can be converted with this method.
Even if there is invalid element, such as integer, it will be replaced withnull.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method throws the exception.
Even if there is invalid value, such as integer, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of boolean/
null - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of boolean.- See Also:
-
getInteger
Gets an integer.When the entity of the object is expected as number, it can be converted into integer with this method.
However, if the evaluated result is not integer,nullis returned.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare Object obj = 100; // Example Integer value = Viv.getInteger(obj);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return(10)"); // Example Integer value = Viv.getInteger(result);The same arguments of
Viv.runandViv.runExcan be given.Integer value = Viv.getInteger("return(10)");- Parameters:
objects- a value that may be number- Returns:
- an integer value.
nullif evaluation is failed or the evaluated result is not an array of integer. - See Also:
-
getInteger
Gets an integer.When the entity of the object is expected as number, it can be converted into integer with this method.
However, if the evaluated result is not integer,nullis returned.- Parameters:
objects- a value that may be numberconfig- configuration if it is needed,nullotherwise- Returns:
- an integer value.
nullif evaluation is failed or the evaluated result is not an array of integer. - See Also:
-
getIntegerEx
Gets an integer. (Permit exception)When the entity of the object is expected as number, it can be converted into integer with this method.
However, if the evaluated result is not integer, the exception is thrown.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare Object obj = 100; // Example int value = Viv.getIntegerEx(obj);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return(10)"); // Example int value = Viv.getIntegerEx(object);The same arguments of
Viv.runandViv.runExcan be given.int value = Viv.getIntegerEx("return(10)");- Parameters:
objects- a value that may be number- Returns:
- an integer value
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not integer.- See Also:
-
getIntegerEx
public static int getIntegerEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets an integer. (Permit exception)When the entity of the object is expected as number, it can be converted into integer with this method.
However, if the evaluated result is not integer, the exception is thrown.- Parameters:
objects- a value that may be numberconfig- configuration if it is needed,nullotherwise- Returns:
- an integer value
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not integer.- See Also:
-
getIntegers
Gets an array of integer.When the entity of the object is expected as an array of number, it can be converted with this method.
However, if there is invalid element, such as boolean,nullis returned.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(1); array.add(3); array.add(5); // Example int[] ints = Viv.getIntegers(array);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return([7, 9])"); // Example int[] ints = Viv.getIntegers(result);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not number, this method returns
null.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.int[] ints = Viv.getIntegers("return([7, 9])");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of integer.
nullif evaluation is failed or the evaluated result is not an array of integer. - See Also:
-
getIntegers
Gets an array of integer.When the entity of the object is expected as an array of number, it can be converted with this method.
However, if there is invalid element, such as boolean,nullis returned.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not number, this method returns
null.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of integer.
nullif evaluation is failed or the evaluated result is not an array of integer. - See Also:
-
getIntegersEx
Gets an array of integer. (Permit exception)When the entity of the object is expected as an array of number, it can be converted with this method.
However, if there is invalid element, such as boolean, the exception is thrown.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(1); array.add(3); array.add(5); // Example int[] ints = Viv.getIntegersEx(array);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return([7, 9])"); // Example int[] ints = Viv.getIntegersEx(object);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not number, this method throws the exception.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.int[] ints = Viv.getIntegersEx("return([7, 9])");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of integer
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of integer.- See Also:
-
getIntegersEx
public static int[] getIntegersEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets an array of integer. (Permit exception)When the entity of the object is expected as an array of number, it can be converted with this method.
However, if there is invalid element, such as boolean, the exception is thrown.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not number, this method throws the exception.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of integer
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of integer.- See Also:
-
getIntegerOrNulls
Gets an array of integer.When the entity of the object is expected as an array of number, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(1); array.add(false); // --> null array.add(5); // Example Integer[] ints = Viv.getIntegerOrNulls(array);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return([7, false])"); // Example Integer[] ints = Viv.getIntegerOrNulls(result);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method returns
null.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.Integer[] ints = Viv.getIntegerOrNulls("return([7, false])");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of integer/
null.nullif evaluation is failed or the evaluated result is not an array of integer. - See Also:
-
getIntegerOrNulls
public static @Nullable Integer @Nullable [] getIntegerOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets an array of integer.When the entity of the object is expected as an array of number, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method returns
null.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of integer/
null.nullif evaluation is failed or the evaluated result is not an array of integer. - See Also:
-
getIntegerOrNullsEx
public static @Nullable Integer[] getIntegerOrNullsEx(@Nullable Object... objects) throws VivException Gets an array of integer. (Permit exception)When the entity of the object is expected as an array of number, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(1); array.add(false); // --> null array.add(5); // Example Integer[] ints = Viv.getIntegerOrNullsEx(array);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return([7, false])"); // Example Integer[] ints = Viv.getIntegerOrNullsEx(object);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method throws the exception.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.Integer[] ints = Viv.getIntegerOrNullsEx("return([7, false])");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of integer/
null - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of integer.- See Also:
-
getIntegerOrNullsEx
public static @Nullable Integer[] getIntegerOrNullsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets an array of integer. (Permit exception)When the entity of the object is expected as an array of number, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method throws the exception.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of integer/
null - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of integer.- See Also:
-
getLong
Gets a long integer.When the entity of the object is expected as number, it can be converted into long integer with this method.
However, if the evaluated result is not long integer,nullis returned.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare Object obj = 100; // Example Long value = Viv.getLong(obj);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return(10)"); // Example Long value = Viv.getLong(result);The same arguments of
Viv.runandViv.runExcan be given.Long value = Viv.getLong("return(10)");- Parameters:
objects- a value that may be number- Returns:
- a long integer value.
nullif evaluation is failed or the evaluated result is not an array of long integer. - See Also:
-
getLong
Gets a long integer.When the entity of the object is expected as number, it can be converted into long integer with this method.
However, if the evaluated result is not long integer,nullis returned.- Parameters:
objects- a value that may be numberconfig- configuration if it is needed,nullotherwise- Returns:
- a long integer value.
nullif evaluation is failed or the evaluated result is not an array of long integer. - See Also:
-
getLongEx
Gets a long integer. (Permit exception)When the entity of the object is expected as number, it can be converted into long integer with this method.
However, if the evaluated result is not long integer, the exception is thrown.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare Object obj = 100; // Example long value = Viv.getLongEx(obj);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return(10)"); // Example long value = Viv.getLongEx(object);The same arguments of
Viv.runandViv.runExcan be given.long value = Viv.getLongEx("return(10)");- Parameters:
objects- a value that may be number- Returns:
- a long integer value
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not long integer.- See Also:
-
getLongEx
public static long getLongEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets a long integer. (Permit exception)When the entity of the object is expected as number, it can be converted into long integer with this method.
However, if the evaluated result is not long integer, the exception is thrown.- Parameters:
objects- a value that may be numberconfig- configuration if it is needed,nullotherwise- Returns:
- a long integer value
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not long integer.- See Also:
-
getLongs
Gets an array of long integer.When the entity of the object is expected as an array of number, it can be converted with this method.
However, if there is invalid element, such as boolean,nullis returned.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(1); array.add(3); array.add(5); // Example long[] longs = Viv.getLongs(array);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return([7, 9])"); // Example long[] longs = Viv.getLongs(result);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not number, this method returns
null.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.long[] longs = Viv.getLongs("return([7, 9])");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of long integer
nullif evaluation is failed or the evaluated result is not an array of long integer. - See Also:
-
getLongs
Gets an array of long integer.When the entity of the object is expected as an array of number, it can be converted with this method.
However, if there is invalid element, such as boolean,nullis returned.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not number, this method returns
null.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of long integer.
nullif evaluation is failed or the evaluated result is not an array of long integer. - See Also:
-
getLongsEx
Gets an array of long integer. (Permit exception)When the entity of the object is expected as an array of number, it can be converted with this method.
However, if there is invalid element, such as boolean, the exception is thrown.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(1); array.add(3); array.add(5); // Example long[] longs = Viv.getLongsEx(array);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return([7, 9])"); // Example long[] longs = Viv.getLongsEx(object);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not number, this method throws the exception.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.long[] longs = Viv.getLongsEx("return([7, 9])");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of long integer
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of long integer.- See Also:
-
getLongsEx
public static long[] getLongsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets an array of long integer. (Permit exception)When the entity of the object is expected as an array of number, it can be converted with this method.
However, if there is invalid element, such as boolean, the exception is thrown.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not number, this method throws the exception.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of long integer
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of long integer.- See Also:
-
getLongOrNulls
Gets an array of long integer.When the entity of the object is expected as an array of number, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(1); array.add(false); // --> null array.add(5); // Example Long[] longs = Viv.getLongOrNulls(array);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return([7, false])"); // Example Long[] longs = Viv.getLongOrNulls(result);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method returns
null.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.Long[] longs = Viv.getLongOrNulls("return([7, false])");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of long integer/
null.nullif evaluation is failed or the evaluated result is not an array of long integer. - See Also:
-
getLongOrNulls
public static @Nullable Long @Nullable [] getLongOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets an array of long integer.When the entity of the object is expected as an array of number, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method returns
null.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of long integer/
null.nullif evaluation is failed or the evaluated result is not an array of long integer. - See Also:
-
getLongOrNullsEx
Gets an array of long integer. (Permit exception)When the entity of the object is expected as an array of number, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(1); array.add(false); // --> null array.add(5); // Example Long[] longs = Viv.getLongOrNullsEx(array);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return([7, false])"); // Example Long[] longs = Viv.getLongOrNullsEx(object);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method throws the exception.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.Long[] longs = Viv.getLongOrNullsEx("return([7, false])");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of long integer/
null - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of long integer.- See Also:
-
getLongOrNullsEx
public static @Nullable Long[] getLongOrNullsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets an array of long integer. (Permit exception)When the entity of the object is expected as an array of number, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method throws the exception.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of long integer/
null - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of long integer.- See Also:
-
getFloat
Gets a floating-point number.When the entity of the object is expected as number, it can be converted into floating-point number with this method.
However, if the evaluated result is not floating-point number,nullis returned.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare Object obj = 1.0; // Example Float value = Viv.getFloat(obj);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return(1.0)"); // Example Float value = Viv.getFloat(result);The same arguments of
Viv.runandViv.runExcan be given.Float value = Viv.getFloat("return(1.0)");- Parameters:
objects- a value that may be number- Returns:
- a floating-point number value.
nullif evaluation is failed or the evaluated result is not an array of floating-point number. - See Also:
-
getFloat
Gets a floating-point number.When the entity of the object is expected as number, it can be converted into floating-point number with this method.
However, if the evaluated result is not floating-point number,nullis returned.- Parameters:
objects- a value that may be numberconfig- configuration if it is needed,nullotherwise- Returns:
- a floating-point number value.
nullif evaluation is failed or the evaluated result is not an array of floating-point number. - See Also:
-
getFloatEx
Gets a floating-point number. (Permit exception)When the entity of the object is expected as number, it can be converted into floating-point number with this method.
However, if the evaluated result is not floating-point number,nullis returned.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare Object obj = 1.0; // Example float value = Viv.getFloatEx(obj);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return(1.0)"); // Example float value = Viv.getFloatEx(object);The same arguments of
Viv.runandViv.runExcan be given.float value = Viv.getFloatEx("return(1.0)");- Parameters:
objects- a value that may be number- Returns:
- a floating-point number value
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not floating-point number.- See Also:
-
getFloatEx
public static float getFloatEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets a floating-point number. (Permit exception)When the entity of the object is expected as number, it can be converted into floating-point number with this method.
However, if the evaluated result is not floating-point number,nullis returned.- Parameters:
objects- a value that may be numberconfig- configuration if it is needed,nullotherwise- Returns:
- a floating-point number value
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not floating-point number.- See Also:
-
getFloats
Gets an array of floating-point number.When the entity of the object is expected as an array of number, it can be converted with this method.
However, if there is invalid element, such as boolean,nullis returned.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(1.0); array.add(3.0); array.add(5.0); // Example float[] floats = Viv.getFloats(array);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return([7.0, 9.0])"); // Example float[] floats = Viv.getFloats(result);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not number, this method returns
null.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.float[] floats = Viv.getFloats("return([7.0, 9.0])");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of floating-point number.
nullif evaluation is failed or the evaluated result is not an array of floating-point number. - See Also:
-
getFloats
Gets an array of floating-point number.When the entity of the object is expected as an array of number, it can be converted with this method.
However, if there is invalid element, such as boolean,nullis returned.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not number, this method returns
null.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of floating-point number.
nullif evaluation is failed or the evaluated result is not an array of floating-point number. - See Also:
-
getFloatsEx
Gets an array of floating-point number. (Permit exception)When the entity of the object is expected as an array of number, it can be converted with this method.
However, if there is invalid element, such as boolean, the exception is thrown.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(1.0); array.add(3.0); array.add(5.0); // Example float[] floats = Viv.getFloatsEx(array);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return([7.0, 9.0])"); // Example float[] floats = Viv.getFloatsEx(object);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not number, this method throws the exception.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.float[] floats = Viv.getFloatsEx("return([7.0, 9.0])");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of floating-point number
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of floating-point number.- See Also:
-
getFloatsEx
public static float[] getFloatsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets an array of floating-point number. (Permit exception)When the entity of the object is expected as an array of number, it can be converted with this method.
However, if there is invalid element, such as boolean, the exception is thrown.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not number, this method throws the exception.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of floating-point number
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of floating-point number.- See Also:
-
getFloatOrNulls
Gets an array of floating-point number.When the entity of the object is expected as an array of number, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(1.0); array.add(false); // --> null array.add(5.0); // Example Float[] floats = Viv.getFloatOrNulls(array);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return([7.0, false])"); // Example Float[] floats = Viv.getFloatOrNulls(result);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method returns
null.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.Float[] floats = Viv.getFloatOrNulls("return([7.0, false])");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of floating-point number/
null.nullif evaluation is failed or the evaluated result is not an array of floating-point number. - See Also:
-
getFloatOrNulls
public static @Nullable Float @Nullable [] getFloatOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets an array of floating-point number.When the entity of the object is expected as an array of number, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method returns
null.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of floating-point number/
null.nullif evaluation is failed or the evaluated result is not an array of floating-point number. - See Also:
-
getFloatOrNullsEx
Gets an array of floating-point number. (Permit exception)When the entity of the object is expected as an array of number, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(1.0); array.add(3.0); array.add(5.0); // Example Float[] floats = Viv.getFloatOrNullsEx(array);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return([7.0, 9.0])"); // Example Float[] floats = Viv.getFloatOrNullsEx(object);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method throws the exception.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.Float[] floats = Viv.getFloatOrNullsEx("return([7.0, 9.0])");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of floating-point number/
null - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of floating-point number.- See Also:
-
getFloatOrNullsEx
public static @Nullable Float[] getFloatOrNullsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets an array of floating-point number. (Permit exception)When the entity of the object is expected as an array of number, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method throws the exception.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of floating-point number/
null - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of floating-point number.- See Also:
-
getDouble
Gets a double-precision floating-point number.When the entity of the object is expected as number, it can be converted into double-precision floating-point number with this method.
However, if the evaluated result is not double-precision floating-point number,nullis returned.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare Object obj = 1.0; // Example Double value = Viv.getDouble(obj);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return(1.0)"); // Example Double value = Viv.getDouble(result);The same arguments of
Viv.runandViv.runExcan be given.double value = Viv.getDouble("return(1.0)");- Parameters:
objects- a value that may be number- Returns:
- a double-precision floating-point number value.
nullif evaluation is failed or the evaluated result is not an array of double-precision floating-point number. - See Also:
-
getDouble
Gets a double-precision floating-point number.When the entity of the object is expected as number, it can be converted into double-precision floating-point number with this method.
However, if the evaluated result is not double-precision floating-point number,nullis returned.- Parameters:
objects- a value that may be numberconfig- configuration if it is needed,nullotherwise- Returns:
- a double-precision floating-point number value.
nullif evaluation is failed or the evaluated result is not an array of double-precision floating-point number. - See Also:
-
getDoubleEx
Gets a double-precision floating-point number. (Permit exception)When the entity of the object is expected as number, it can be converted into double-precision floating-point number with this method.
However, if the evaluated result is not double-precision floating-point number, the exception is thrown.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare Object obj = 1.0; // Example double value = Viv.getDoubleEx(obj);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return(1.0)"); // Example double value = Viv.getDoubleEx(object);The same arguments of
Viv.runandViv.runExcan be given.double value = Viv.getDoubleEx("return(1.0)");- Parameters:
objects- a value that may be number- Returns:
- a double-precision floating-point number value
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not double-precision floating-point number.- See Also:
-
getDoubleEx
public static double getDoubleEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets a double-precision floating-point number. (Permit exception)When the entity of the object is expected as number, it can be converted into double-precision floating-point number with this method.
However, if the evaluated result is not double-precision floating-point number, the exception is thrown.- Parameters:
objects- a value that may be numberconfig- configuration if it is needed,nullotherwise- Returns:
- a double-precision floating-point number value
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not double-precision floating-point number.- See Also:
-
getDoubles
Gets an array of double-precision floating-point number.When the entity of the object is expected as an array of number, it can be converted with this method.
However, if there is invalid element, such as boolean,nullis returned.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(1.0); array.add(3.0); array.add(5.0); // Example double[] doubles = Viv.getDoubles(array);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return([7.0, 9.0])"); // Example double[] doubles = Viv.getDoubles(result);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not number, this method returns
null.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.double[] doubles = Viv.getDoubles("return([7.0, 9.0])");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of double-precision floating-point number.
nullif evaluation is failed or the evaluated result is not an array of double-precision floating-point number. - See Also:
-
getDoubles
Gets an array of double-precision floating-point number.When the entity of the object is expected as an array of number, it can be converted with this method.
However, if there is invalid element, such as boolean,nullis returned.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not number, this method returns
null.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of double-precision floating-point number.
nullif evaluation is failed or the evaluated result is not an array of double-precision floating-point number. - See Also:
-
getDoublesEx
Gets an array of double-precision floating-point number. (Permit exception)When the entity of the object is expected as an array of number, it can be converted with this method.
However, if there is invalid element, such as boolean, the exception is thrown.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(1.0); array.add(3.0); array.add(5.0); // Example double[] doubles = Viv.getDoublesEx(array);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return([7.0, 9.0])"); // Example double[] doubles = Viv.getDoublesEx(object);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not number, this method throws the exception.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.double[] doubles = Viv.getDoublesEx("return([7.0, 9.0])");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of double-precision floating-point number
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of double-precision floating-point number.- See Also:
-
getDoublesEx
public static double[] getDoublesEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets an array of double-precision floating-point number. (Permit exception)When the entity of the object is expected as an array of number, it can be converted with this method.
However, if there is invalid element, such as boolean, the exception is thrown.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not number, this method throws the exception.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of double-precision floating-point number
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of double-precision floating-point number.- See Also:
-
getDoubleOrNulls
Gets an array of double-precision floating-point number.When the entity of the object is expected as an array of number, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(1.0); array.add(false); // --> null array.add(5.0); // Example Double[] doubles = Viv.getDoubleOrNulls(array);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return([7.0, false])"); // Example Double[] doubles = Viv.getDoubleOrNulls(result);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method returns
null.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.Double[] doubles = Viv.getDoubleOrNulls("return([7.0, false])");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of double-precision floating-point number/
null.nullif evaluation is failed or the evaluated result is not an array of double-precision floating-point number. - See Also:
-
getDoubleOrNulls
public static @Nullable Double @Nullable [] getDoubleOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets an array of double-precision floating-point number.When the entity of the object is expected as an array of number, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method returns
null.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of double-precision floating-point number/
null.nullif evaluation is failed or the evaluated result is not an array of double-precision floating-point number. - See Also:
-
getDoubleOrNullsEx
public static @Nullable Double[] getDoubleOrNullsEx(@Nullable Object... objects) throws VivException Gets an array of double-precision floating-point number. (Permit exception)When the entity of the object is expected as an array of number, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add(1.0); array.add(false); // --> null array.add(5.0); // Example Double[] doubles = Viv.getDoubleOrNullsEx(array);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return([7.0, false])"); // Example Double[] doubles = Viv.getDoubleOrNullsEx(object);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method throws the exception.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.Double[] doubles = Viv.getDoubleOrNullsEx("return([7.0, false])");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of double-precision floating-point number/
null - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of double-precision floating-point number.- See Also:
-
getDoubleOrNullsEx
public static @Nullable Double[] getDoubleOrNullsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets an array of double-precision floating-point number. (Permit exception)When the entity of the object is expected as an array of number, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method throws the exception.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of double-precision floating-point number/
null - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of double-precision floating-point number.- See Also:
-
getString
Gets a string.When the entity of the object is expected as string, it can be converted with this method.
However, if the evaluated result is not string,nullis returned.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare Object obj = "test"; // Example String value = Viv.getString(obj);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("a='test'", "return(a)"); // Example String value = Viv.getString(result);The same arguments of
Viv.runandViv.runExcan be given.
On the other hand, the following sample may be looked like strange. But the single string is passed through simply.String value = Viv.getString("a='test'", "return(a)");String value1 = Viv.getString("return('test')"); // "return('test')" String value2 = Viv.getString("a='test'", "return(a)"); // "a='test'", "return(a)"- Parameters:
objects- object that may be a string value- Returns:
- a string value.
nullif evaluation is failed or the evaluated result is not string. - See Also:
-
getString
Gets a string.When the entity of the object is expected as string, it can be converted with this method.
However, if the evaluated result is not string,nullis returned.- Parameters:
objects- object that may be a string valueconfig- configuration if it is needed,nullotherwise- Returns:
- a string value.
nullif evaluation is failed or the evaluated result is not string. - See Also:
-
getStringEx
Gets a string. (Permit exception)When the entity of the object is expected as string, it can be converted with this method.
However, if the evaluated result is not string, the exception is thrown.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare Object obj = "test"; // Example String value = Viv.getStringEx(obj);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("a='test'", "return(a)"); // Example String value = Viv.getStringEx(object); // "test"The same arguments of
Viv.runandViv.runExcan be given.
On the other hand, the following sample may be looked like strange. But the single string is passed through simply.String value = Viv.getStringEx("a='test'", "return(a)"); // "test"String value1 = Viv.getStringEx("return('test')"); // "return('test')" String value2 = Viv.getStringEx("a='test'", "return(a)"); // "a='test'", "return(a)"- Parameters:
objects- object that may be a string value- Returns:
- a string value
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not string.- See Also:
-
getStringEx
public static String getStringEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets a string. (Permit exception)When the entity of the object is expected as string, it can be converted with this method.
However, if the evaluated result is not string, the exception is thrown.- Parameters:
objects- object that may be a string valueconfig- configuration if it is needed,nullotherwise- Returns:
- a string value
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not string.- See Also:
-
getStrings
Gets an array of string.When the entity of the object is expected as an array of string, it can be converted with this method.
However, if there is invalid element, such as integer,nullis returned.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add("alpha"); array.add("beta"); array.add("gamma"); // Example String[] strings = Viv.getStrings(array);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return(['alpha', 'beta'])"); // Example String[] strings = Viv.getStrings(result);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key or value is not String, this method returns
null.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.String[] strings = Viv.getStrings("{\"a\": \"alpha\", \"b\": \"beta\"}");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of string.
nullif evaluation is failed or the evaluated result is not an array of string. - See Also:
-
getStrings
Gets an array of string.When the entity of the object is expected as an array of string, it can be converted with this method.
However, if there is invalid element, such as integer,nullis returned.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key or value is not String, this method returns
null.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of string.
nullif evaluation is failed or the evaluated result is not an array of string. - See Also:
-
getStringsEx
Gets an array of string. (Permit exception)When the entity of the object is expected as an array of string, it can be converted with this method.
However, if there is invalid element, such as integer, the exception is thrown.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add("alpha"); array.add("beta"); array.add("gamma"); // Example String[] strings = Viv.getStringsEx(array);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return(['alpha', 'beta'])"); // Example String[] strings = Viv.getStringsEx(object);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key or value is not String, this method throws the exception.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.String[] strings = Viv.getStringsEx("{\"a\": \"alpha\", \"b\": \"beta\"}");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of string
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of string.- See Also:
-
getStringsEx
public static String[] getStringsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets an array of String. (Permit exception)When the entity of the object is expected as an array of string, it can be converted with this method.
However, if there is invalid element, such as integer, the exception is thrown.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key or value is not String, this method throws the exception.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of string
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of string.- See Also:
-
getStringOrNulls
Gets an array of string.When the entity of the object is expected as an array of string, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add("alpha"); array.add(false); // --> null array.add("gamma"); // Example String[] strings = Viv.getStringOrNulls(array);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return(['alpha', false])"); // Example String[] strings = Viv.getStringOrNulls(result);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method returns
null.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.String[] strings = Viv.getStringOrNulls("{\"a\": \"alpha\", \"b\": false}");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of string/
null.nullif evaluation is failed or the evaluated result is not an array of string. - See Also:
-
getStringOrNulls
public static @Nullable String @Nullable [] getStringOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets an array of string.When the entity of the object is expected as an array of string, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method returns
null.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of string/
null.nullif evaluation is failed or the evaluated result is not an array of string. - See Also:
-
getStringOrNullsEx
public static @Nullable String[] getStringOrNullsEx(@Nullable Object... objects) throws VivException Gets an array of string. (Permit exception)When the entity of the object is expected as an array of string, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add("alpha"); array.add(false); // --> null array.add("gamma"); // Example String[] strings = Viv.getStringOrNullsEx(array);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return(['alpha', false])"); // Example String[] strings = Viv.getStringOrNullsEx(object);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method throws the exception.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.String[] strings = Viv.getStringOrNullsEx("{\"a\": \"alpha\", \"b\": false}");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of string/
null - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of string.- See Also:
-
getStringOrNullsEx
public static @Nullable String[] getStringOrNullsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets an array of String. (Permit exception)When the entity of the object is expected as an array of string, it can be converted with this method.
Even if there is invalid element, such as boolean, it will be replaced withnull.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method throws the exception.
Even if there is invalid value, such as boolean, it will be replaced withnull.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of string/
null - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of string.- See Also:
-
getObjects
Gets an array of object.When the entity of the object is expected as an array of
Object, it can be converted with this method.
However, if there isnull,nullis returned as the whole returned value.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add("alpha"); array.add(true); array.add(100); // Example Object[] objects = Viv.getObjects(array);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return(['alpha', true])"); // Example Object[] objects = Viv.getObjects(result);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not Object, this method returns
null.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.Object[] objects = Viv.getObjects("{\"a\": \"alpha\", \"b\": true}");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of Object.
nullif evaluation is failed or the evaluated result is not an array of Object. - See Also:
-
getObjects
Gets an array of object.When the entity of the object is expected as an array of
Object, it can be converted with this method.
However, if there isnull,nullis returned as the whole returned value.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not Object, this method returns
null.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of Object.
nullif evaluation is failed or the evaluated result is not an array of Object. - See Also:
-
getObjectsEx
Gets an array of object. (Permit exception)When the entity of the object is expected as an array of
Object, it can be converted with this method.
However, if there isnull, the exception is thrown.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add("alpha"); array.add(true); array.add(100); // Example Object[] objects = Viv.getObjectsEx(array);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return(['alpha', true])"); // Example Object[] objects = Viv.getObjectsEx(object);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not Object, this method throws the exception.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.Object[] objects = Viv.getObjectsEx("{\"a\": \"alpha\", \"b\": true}");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of Object
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of Object.- See Also:
-
getObjectsEx
public static Object[] getObjectsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets an array of object. (Permit exception)When the entity of the object is expected as an array of
Object, it can be converted with this method.
However, if there isnull, the exception is thrown.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String or value is not Object, this method throws the exception.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of Object
- Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of Object.- See Also:
-
getObjectOrNulls
Gets an array of object.When the entity of the object is expected as an array of
Object, it can be converted with this method.
Even if there isnull, it is permitted.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add("alpha"); array.add(null); // --> null array.add(100); // Example Object[] objects = Viv.getObjectOrNulls(array);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("return(['alpha', null])"); // Example Object[] objects = Viv.getObjectOrNulls(result);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method returns
nullas the whole returned value.
Even if there isnullas value, it is permitted.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.Object[] objects = Viv.getObjectOrNulls("{\"a\": \"alpha\", \"b\": null}");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of Object/
null.nullif evaluation is failed or the evaluated result is not an array of Object. - See Also:
-
getObjectOrNulls
public static @Nullable Object @Nullable [] getObjectOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets an array of object.When the entity of the object is expected as an array of
Object, it can be converted with this method.
Even if there isnull, it is permitted.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method returns
nullas the whole returned value.
Even if there isnullas value, it is permitted.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of Object/
null.nullif evaluation is failed or the evaluated result is not an array of Object. - See Also:
-
getObjectOrNullsEx
public static @Nullable Object[] getObjectOrNullsEx(@Nullable Object... objects) throws VivException Gets an array of object. (Permit exception)When the entity of the object is expected as an array of
Object, it can be converted with this method.
Even if there isnull, it is permitted.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Object> array = new ArrayList<>(); array.add("alpha"); array.add(null); // --> null array.add(100); // Example Object[] objects = Viv.getObjectOrNullsEx(array);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("return(['alpha', null])"); // Example Object[] objects = Viv.getObjectOrNullsEx(object);When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method throws the exception.
Even if there isnullas value, it is permitted.
The order of values is unknown. The appended order into key-value pairs is ignored.The same arguments of
Viv.runandViv.runExcan be given.Object[] objects = Viv.getObjectOrNullsEx("{\"a\": \"alpha\", \"b\": null}");- Parameters:
objects- a value that may be an array or a block- Returns:
- an array of Object/
null - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of Object.- See Also:
-
getObjectOrNullsEx
public static @Nullable Object[] getObjectOrNullsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets an array of object. (Permit exception)When the entity of the object is expected as an array of
Object, it can be converted with this method.
Even if there isnull, it is permitted.When key-value pairs (a.k.a. block, object, map, dict, hashes, or associative arrays) is given, its values are treated. In other words, keys are ignored. However, if key is not String, this method throws the exception.
Even if there isnullas value, it is permitted.
The order of values is unknown. The appended order into key-value pairs is ignored.- Parameters:
objects- a value that may be an array or a blockconfig- configuration if it is needed,nullotherwise- Returns:
- an array of Object/
null - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is not an array of Object.- See Also:
-
getArrayList
Gets anArrayList<@Nullable Object>.When the entity of the object is expected as
ArrayList<@Nullable Object>, it can be converted with this method.
However, if the evaluated result is notArrayList<@Nullable Object>,nullis returned.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Integer> array = new ArrayList<>(); array.add(10); array.add(20); Object obj = array; // Example ArrayList<@Nullable Object> value = Viv.getArrayList(obj);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("a=[]", "a+=10", "a+=20", "return(a)"); // Example ArrayList<@Nullable Object> value = Viv.getArrayList(result); Object element1 = value.get(0); // 10 Object element2 = value.get(1); // 20The same arguments of
Viv.runandViv.runExcan be given.ArrayList<@Nullable Object> value = Viv.getArrayList("a=[]", "a+=10", "a+=20", "return(a)");- Parameters:
objects- object that may be aArrayList<@Nullable Object>value- Returns:
- an
ArrayList<@Nullable Object>value.nullif evaluation is failed or the evaluated result is notArrayList<@Nullable Object>. - See Also:
-
getArrayList
public static @Nullable ArrayList<@Nullable Object> getArrayList(@Nullable Object[] objects, @Nullable Config config) Gets anArrayList<@Nullable Object>.When the entity of the object is expected as
ArrayList<@Nullable Object>, it can be converted with this method.
However, if the evaluated result is notArrayList<@Nullable Object>,nullis returned.- Parameters:
objects- object that may be aArrayList<@Nullable Object>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an
ArrayList<@Nullable Object>value.nullif evaluation is failed or the evaluated result is notArrayList<@Nullable Object>. - See Also:
-
getArrayListEx
public static ArrayList<@Nullable Object> getArrayListEx(@Nullable Object... objects) throws VivException Gets anArrayList<@Nullable Object>. (Permit exception)When the entity of the object is expected as
ArrayList<@Nullable Object>, it can be converted with this method.
However, if the evaluated result is notArrayList<@Nullable Object>, the exception is thrown.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare ArrayList<Integer> array = new ArrayList<>(); array.add(10); array.add(20); Object obj = array; // Example ArrayList<@Nullable Object> value = Viv.getArrayListEx(obj);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("a=[]", "a+=10", "a+=20", "return(a)"); // Example ArrayList<@Nullable Object> value = Viv.getArrayListEx(object); Object element1 = value.get(0); // 10 Object element2 = value.get(1); // 20The same arguments of
Viv.runandViv.runExcan be given.ArrayList<@Nullable Object> value = Viv.getArrayListEx("a=[]", "a+=10", "a+=20", "return(a)");- Parameters:
objects- object that may be aArrayList<@Nullable Object>value- Returns:
- an
ArrayList<@Nullable Object>value - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notArrayList<@Nullable Object>.- See Also:
-
getArrayListEx
public static ArrayList<@Nullable Object> getArrayListEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets anArrayList<@Nullable Object>. (Permit exception)When the entity of the object is expected as
ArrayList<@Nullable Object>, it can be converted with this method.
However, if the evaluated result is notArrayList<@Nullable Object>, the exception is thrown.- Parameters:
objects- object that may be aArrayList<@Nullable Object>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an
ArrayList<@Nullable Object>value - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notArrayList<@Nullable Object>.- See Also:
-
getHashMap
Gets aHashMap<String, @Nullable Object>.When the entity of the object is expected as
HashMap<String, @Nullable Object>, it can be converted with this method.
However, if the evaluated result is notHashMap<String, @Nullable Object>,nullis returned.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare HashMap<String, Integer> map = new HashMap<>(); map.put("a", 70); map.put("b", 30); Object obj = map; // Example HashMap<String, @Nullable Object> value = Viv.getHashMap(obj);Viv.runorViv.runExmethod.// Prepare Result result = Viv.run("{\"a\": 70, \"b\": 30}"); // Example HashMap<String, @Nullable Object> value = Viv.getHashMap(result);The same arguments of
Viv.runandViv.runExcan be given.HashMap<String, @Nullable Object> value = Viv.getHashMap("{\"a\": 70, \"b\": 30}");- Parameters:
objects- object that may be aHashMap<String, @Nullable Object>value- Returns:
- a
HashMap<String, @Nullable Object>value.nullif evaluation is failed or the evaluated result is notHashMap<String, @Nullable Object>. - See Also:
-
getHashMap
public static @Nullable HashMap<String,@Nullable Object> getHashMap(@Nullable Object[] objects, @Nullable Config config) Gets aHashMap<String, @Nullable Object>.When the entity of the object is expected as
HashMap<String, @Nullable Object>, it can be converted with this method.
However, if the evaluated result is notHashMap<String, @Nullable Object>,nullis returned.- Parameters:
objects- object that may be aHashMap<String, @Nullable Object>valueconfig- configuration if it is needed,nullotherwise- Returns:
- a
HashMap<String, @Nullable Object>value.nullif evaluation is failed or the evaluated result is notHashMap<String, @Nullable Object>. - See Also:
-
getHashMapEx
public static HashMap<String,@Nullable Object> getHashMapEx(@Nullable Object... objects) throws VivException Gets aHashMap<String, @Nullable Object>. (Permit exception)When the entity of the object is expected as
HashMap<String, @Nullable Object>, it can be converted with this method.
However, if the evaluated result is notHashMap<String, @Nullable Object>, the exception is thrown.In a simply way, one value is given as argument.
For example,
Mostly, this is used for the returned value of// Prepare HashMap<String, Integer> map = new HashMap<>(); map.put("a", 70); map.put("b", 30); Object obj = map; // Example HashMap<String, @Nullable Object> value = Viv.getHashMapEx(obj);Viv.runorViv.runExmethod.// Prepare Object object = Viv.runEx("{\"a\": 70, \"b\": 30}"); // Example HashMap<String, @Nullable Object> value = Viv.getHashMapEx(object);The same arguments of
Viv.runandViv.runExcan be given.HashMap<String, @Nullable Object> value = Viv.getHashMapEx("{\"a\": 70, \"b\": 30}");- Parameters:
objects- object that may be aHashMap<String, @Nullable Object>value- Returns:
- a
HashMap<String, @Nullable Object>value - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, @Nullable Object>.- See Also:
-
getHashMapEx
public static HashMap<String,@Nullable Object> getHashMapEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets aHashMap<String, @Nullable Object>. (Permit exception)When the entity of the object is expected as
HashMap<String, @Nullable Object>, it can be converted with this method.
However, if the evaluated result is notHashMap<String, @Nullable Object>, the exception is thrown.- Parameters:
objects- object that may be aHashMap<String, @Nullable Object>valueconfig- configuration if it is needed,nullotherwise- Returns:
- a
HashMap<String, @Nullable Object>value - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, @Nullable Object>.- See Also:
-
getKeyValueBooleans
Gets key-value pairs as an array. All values are expected as Boolean. When other is given,nullis returned.For example,
// {"a": true, "b": false} String code = "\"a\": true, \"b\": false"; // Evaluate directly. Viv.KeyValue<Boolean>[] pairs = Viv.getKeyValueBooleans(code); for (Viv.KeyValue<Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: false } // Evaluate result. Result result = Viv.run(code); pairs = Viv.getKeyValueBooleans(result); for (Viv.KeyValue<Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: false } // Whole values are lost even if there is only one foreign object. code = "\"a\": true, \"b\": null"; // replace pairs = Viv.getKeyValueBooleans(code); System.out.println(pairs == null); // true code = "\"a\": true, \"b\": 10"; // replace pairs = Viv.getKeyValueBooleans(code); System.out.println(pairs == null); // truegetKeyValueBooleanOrNulls(Object...)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Boolean>value- Returns:
- an array of key-value pairs as
KeyValue<Boolean>[].nullif evaluation is failed or the evaluated result is notHashMap<String, Boolean>.
-
getKeyValueBooleans
public static Viv.KeyValue<Boolean> @Nullable [] getKeyValueBooleans(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array. All values are expected as Boolean. When other is given,nullis returned.For example,
// {"a": true, "b": false} String[] codes = {"\"a\": true", "\"b\": false"}; // Evaluate directly. Viv.KeyValue<Boolean>[] pairs = Viv.getKeyValueBooleans(codes, null); for (Viv.KeyValue<Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: false } // Evaluate result. Result result = Viv.run(codes, null); pairs = Viv.getKeyValueBooleans(result); for (Viv.KeyValue<Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: false } // Whole values are lost even if there is only one foreign object. codes[1] = "\"b\": null"; // replace pairs = Viv.getKeyValueBooleans(codes, null); System.out.println(pairs == null); // true codes[1] = "\"b\": 10"; // replace pairs = Viv.getKeyValueBooleans(codes, null); System.out.println(pairs == null); // truegetKeyValueBooleanOrNulls(Object[], Config)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Boolean>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<Boolean>[].nullif evaluation is failed or the evaluated result is notHashMap<String, Boolean>.
-
getKeyValueBooleansEx
public static Viv.KeyValue<Boolean>[] getKeyValueBooleansEx(@Nullable Object... objects) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Boolean. When other is given, exception is thrown.For example,
// {"a": true, "b": false} String code = "\"a\": true, \"b\": false"; // Evaluate directly. Viv.KeyValue<Boolean>[] pairs = Viv.getKeyValueBooleansEx(code); for (Viv.KeyValue<Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: false } // Evaluate result. Object object = Viv.runEx(code); pairs = Viv.getKeyValueBooleansEx(object); for (Viv.KeyValue<Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: false } // Whole values are lost even if there is only one foreign object. code = "\"a\": true, \"b\": null"; // replace pairs = Viv.getKeyValueBooleansEx(code); // Exception is thrown. code = "\"a\": true, \"b\": 10"; // replace pairs = Viv.getKeyValueBooleansEx(code); // Exception is thrown.getKeyValueBooleanOrNullsEx(Object...)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Boolean>value- Returns:
- an array of key-value pairs as
KeyValue<Boolean>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, Boolean>.
-
getKeyValueBooleansEx
public static Viv.KeyValue<Boolean>[] getKeyValueBooleansEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Boolean. When other is given, exception is thrown.For example,
// {"a": true, "b": false} String[] codes = {"\"a\": true", "\"b\": false"}; // Evaluate directly. Viv.KeyValue<Boolean>[] pairs = Viv.getKeyValueBooleansEx(codes, null); for (Viv.KeyValue<Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: false } // Evaluate result. Object object = Viv.runEx(codes, null); pairs = Viv.getKeyValueBooleansEx(object); for (Viv.KeyValue<Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: false } // Whole values are lost even if there is only one foreign object. codes[1] = "\"b\": null"; // replace pairs = Viv.getKeyValueBooleansEx(codes); // Exception is thrown. codes[1] = "\"b\": 10"; // replace pairs = Viv.getKeyValueBooleansEx(codes); // Exception is thrown.getKeyValueBooleanOrNullsEx(Object[], Config)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Boolean>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<Boolean>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, Boolean>.
-
getKeyValueBooleanOrNulls
public static Viv.KeyValue<@Nullable Boolean> @Nullable [] getKeyValueBooleanOrNulls(@Nullable Object... objects) Gets key-value pairs as an array. All values are expected as Boolean. When other is given, it is replaced withnull.For example,
// {"a": true, "b": null} String code = "{\"a\": true, \"b\": null}"; // Evaluate directly. Viv.KeyValue<@Nullable Boolean>[] pairs = Viv.getKeyValueBooleanOrNulls(code); for (Viv.KeyValue<@Nullable Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: null } // Evaluate result. Result result = Viv.run(code); pairs = Viv.getKeyValueBooleanOrNulls(result); for (Viv.KeyValue<@Nullable Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: null } // Evaluate another value directly. pairs = Viv.getKeyValueBooleanOrNulls("{\"a\": true, \"b\": 10}"); for (Viv.KeyValue<@Nullable Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Boolean>value- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Boolean>[].nullif evaluation is failed or the evaluated result is notHashMap<String, @Nullable Boolean>.
-
getKeyValueBooleanOrNulls
public static Viv.KeyValue<@Nullable Boolean> @Nullable [] getKeyValueBooleanOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array. All values are expected as Boolean. When other is given, it is replaced withnull.For example,
// {"a": true, "b": null} String[] codes = {"\"a\": true", "\"b\": null"}; // Evaluate directly. Viv.KeyValue<@Nullable Boolean>[] pairs = Viv.getKeyValueBooleanOrNulls(codes, null); for (Viv.KeyValue<@Nullable Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: null } // Evaluate result. Result result = Viv.run(codes, null); pairs = Viv.getKeyValueBooleanOrNulls(result); for (Viv.KeyValue<@Nullable Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: null } // Evaluate another value directly. codes[1] = "\"b\": 10"; // replace pairs = Viv.getKeyValueBooleanOrNulls(codes, null); for (Viv.KeyValue<@Nullable Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Boolean>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Boolean>[].nullif evaluation is failed or the evaluated result is notHashMap<String, @Nullable Boolean>.
-
getKeyValueBooleanOrNullsEx
public static Viv.KeyValue<@Nullable Boolean>[] getKeyValueBooleanOrNullsEx(@Nullable Object... objects) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Boolean. When other is given, it is replaced withnull.For example,
// {"a": true, "b": null} String code = "{\"a\": true, \"b\": null}"; // Evaluate directly. Viv.KeyValue<@Nullable Boolean>[] pairs = Viv.getKeyValueBooleanOrNullsEx(code); for (Viv.KeyValue<@Nullable Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: null } // Evaluate result. Object object = Viv.runEx(code); pairs = Viv.getKeyValueBooleanOrNullsEx(object); for (Viv.KeyValue<@Nullable Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: null } // Evaluate another value directly. pairs = Viv.getKeyValueBooleanOrNullsEx("{\"a\": true, \"b\": 10}"); for (Viv.KeyValue<@Nullable Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Boolean>value- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Boolean>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, @Nullable Boolean>.
-
getKeyValueBooleanOrNullsEx
public static Viv.KeyValue<@Nullable Boolean>[] getKeyValueBooleanOrNullsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Boolean. When other is given, it is replaced withnull.For example,
// {"a": true, "b": null} String[] codes = {"\"a\": true", "\"b\": null"}; // Evaluate directly. Viv.KeyValue<@Nullable Boolean>[] pairs = Viv.getKeyValueBooleanOrNullsEx(codes, null); for (Viv.KeyValue<@Nullable Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: null } // Evaluate result. Object object = Viv.runEx(codes, null); pairs = Viv.getKeyValueBooleanOrNullsEx(object); for (Viv.KeyValue<@Nullable Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: null } // Evaluate another value directly. codes[1] = "\"b\": 10"; // replace pairs = Viv.getKeyValueBooleanOrNullsEx(codes, null); for (Viv.KeyValue<@Nullable Boolean> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: true, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Boolean>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Boolean>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, @Nullable Boolean>.
-
getKeyValueIntegers
Gets key-value pairs as an array. All values are expected as Integer. When other is given,nullis returned.For example,
// {"a": 10, "b": 20} String code = "{\"a\": 10, \"b\": 20}"; // Evaluate directly. Viv.KeyValue<Integer>[] pairs = Viv.getKeyValueIntegers(code); for (Viv.KeyValue<Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: 20 } // Evaluate result. Result result = Viv.run(code); pairs = Viv.getKeyValueIntegers(result); for (Viv.KeyValue<Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: 20 } // Whole values are lost even if there is only one foreign object. code = "{\"a\": 10, \"b\": null}"; // replace pairs = Viv.getKeyValueIntegers(code); System.out.println(pairs == null); // true code = "{\"a\": 10, \"b\": true}"; // replace pairs = Viv.getKeyValueIntegers(code); System.out.println(pairs == null); // truegetKeyValueIntegerOrNulls(Object...)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Integer>value- Returns:
- an array of key-value pairs as
KeyValue<Integer>[].nullif evaluation is failed or the evaluated result is notHashMap<String, Integer>.
-
getKeyValueIntegers
public static Viv.KeyValue<Integer> @Nullable [] getKeyValueIntegers(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array. All values are expected as Integer. When other is given,nullis returned.For example,
// {"a": 10, "b": 20} String[] codes = {"\"a\": 10", "\"b\": 20"}; // Evaluate directly. Viv.KeyValue<Integer>[] pairs = Viv.getKeyValueIntegers(codes, null); for (Viv.KeyValue<Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: 20 } // Evaluate result. Result result = Viv.run(codes, null); pairs = Viv.getKeyValueIntegers(result); for (Viv.KeyValue<Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: 20 } // Whole values are lost even if there is only one foreign object. codes[1] = "\"b\": null"; // replace pairs = Viv.getKeyValueIntegers(codes, null); System.out.println(pairs == null); // true codes[1] = "\"b\": true"; // replace pairs = Viv.getKeyValueIntegers(codes, null); System.out.println(pairs == null); // truegetKeyValueIntegerOrNulls(Object[], Config)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Integer>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<Integer>[].nullif evaluation is failed or the evaluated result is notHashMap<String, Integer>.
-
getKeyValueIntegersEx
public static Viv.KeyValue<Integer>[] getKeyValueIntegersEx(@Nullable Object... objects) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Integer. When other is given, exception is thrown.For example,
// {"a": 10, "b": 20} String code = "{\"a\": 10, \"b\": 20}"; // Evaluate directly. Viv.KeyValue<Integer>[] pairs = Viv.getKeyValueIntegersEx(code); for (Viv.KeyValue<Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: 20 } // Evaluate result. Object object = Viv.runEx(code); pairs = Viv.getKeyValueIntegersEx(object); for (Viv.KeyValue<Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: 20 } // Whole values are lost even if there is only one foreign object. code = "{\"a\": 10, \"b\": null}"; // replace pairs = Viv.getKeyValueIntegersEx(code); // Exception is thrown. code = "{\"a\": 10, \"b\": true}"; // replace pairs = Viv.getKeyValueIntegersEx(code); // Exception is thrown.getKeyValueIntegerOrNullsEx(Object...)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Integer>value- Returns:
- an array of key-value pairs as
KeyValue<Integer>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, Integer>.
-
getKeyValueIntegersEx
public static Viv.KeyValue<Integer>[] getKeyValueIntegersEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Integer. When other is given, exception is thrown.For example,
// {"a": 10, "b": 20} String[] codes = {"\"a\": 10", "\"b\": 20"}; // Evaluate directly. Viv.KeyValue<Integer>[] pairs = Viv.getKeyValueIntegersEx(codes, null); for (Viv.KeyValue<Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: 20 } // Evaluate result. Object object = Viv.runEx(codes, null); pairs = Viv.getKeyValueIntegersEx(object); for (Viv.KeyValue<Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: 20 } // Whole values are lost even if there is only one foreign object. codes[1] = "\"b\": null"; // replace pairs = Viv.getKeyValueIntegersEx(codes, null); // Exception is thrown. codes[1] = "\"b\": true"; // replace pairs = Viv.getKeyValueIntegersEx(codes, null); // Exception is thrown.getKeyValueIntegerOrNullsEx(Object[], Config)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Integer>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<Integer>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, Integer>.
-
getKeyValueIntegerOrNulls
public static Viv.KeyValue<@Nullable Integer> @Nullable [] getKeyValueIntegerOrNulls(@Nullable Object... objects) Gets key-value pairs as an array. All values are expected as Integer. When other is given, it is replaced withnull.For example,
// {"a": 10, "b": null} String code = "{\"a\": 10, \"b\": null}"; // Evaluate directly. Viv.KeyValue<@Nullable Integer>[] pairs = Viv.getKeyValueIntegerOrNulls(code); for (Viv.KeyValue<@Nullable Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null } // Evaluate result. Result result = Viv.run(code); pairs = Viv.getKeyValueIntegerOrNulls(result); for (Viv.KeyValue<@Nullable Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null } // Evaluate another value directly. pairs = Viv.getKeyValueIntegerOrNulls("{\"a\": 10, \"b\": true}"); for (Viv.KeyValue<@Nullable Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Integer>value- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Integer>[].nullif evaluation is failed or the evaluated result is notHashMap<String, @Nullable Integer>.
-
getKeyValueIntegerOrNulls
public static Viv.KeyValue<@Nullable Integer> @Nullable [] getKeyValueIntegerOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array. All values are expected as Integer. When other is given, it is replaced withnull.For example,
// {"a": 10, "b": null} String[] codes = {"\"a\": 10", "\"b\": null"}; // Evaluate directly. Viv.KeyValue<@Nullable Integer>[] pairs = Viv.getKeyValueIntegerOrNulls(codes, null); for (Viv.KeyValue<@Nullable Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null } // Evaluate result. Result result = Viv.run(codes, null); pairs = Viv.getKeyValueIntegerOrNulls(result); for (Viv.KeyValue<@Nullable Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null } // Evaluate another value directly. codes[1] = "\"b\": true"; // replace pairs = Viv.getKeyValueIntegerOrNulls(codes, null); for (Viv.KeyValue<@Nullable Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Integer>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Integer>[].nullif evaluation is failed or the evaluated result is notHashMap<String, @Nullable Integer>.
-
getKeyValueIntegerOrNullsEx
public static Viv.KeyValue<@Nullable Integer>[] getKeyValueIntegerOrNullsEx(@Nullable Object... objects) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Integer. When other is given, it is replaced withnull.For example,
// {"a": 10, "b": null} String code = "{\"a\": 10, \"b\": null}"; // Evaluate directly. Viv.KeyValue<@Nullable Integer>[] pairs = Viv.getKeyValueIntegerOrNullsEx(code); for (Viv.KeyValue<@Nullable Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null } // Evaluate result. Object object = Viv.runEx(code); pairs = Viv.getKeyValueIntegerOrNullsEx(object); for (Viv.KeyValue<@Nullable Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null } // Evaluate another value directly. pairs = Viv.getKeyValueIntegerOrNullsEx("{\"a\": 10, \"b\": true}"); for (Viv.KeyValue<@Nullable Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Integer>value- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Integer>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, @Nullable Integer>.
-
getKeyValueIntegerOrNullsEx
public static Viv.KeyValue<@Nullable Integer>[] getKeyValueIntegerOrNullsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Integer. When other is given, it is replaced withnull.For example,
// {"a": 10, "b": null} String[] codes = {"\"a\": 10", "\"b\": null"}; // Evaluate directly. Viv.KeyValue<@Nullable Integer>[] pairs = Viv.getKeyValueIntegerOrNullsEx(codes, null); for (Viv.KeyValue<@Nullable Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null } // Evaluate result. Object object = Viv.runEx(codes, null); pairs = Viv.getKeyValueIntegerOrNullsEx(object); for (Viv.KeyValue<@Nullable Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null } // Evaluate another value directly. codes[1] = "\"b\": true"; // replace pairs = Viv.getKeyValueIntegerOrNullsEx(codes, null); for (Viv.KeyValue<@Nullable Integer> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Integer>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Integer>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, @Nullable Integer>.
-
getKeyValueLongs
Gets key-value pairs as an array. All values are expected as Long. When other is given,nullis returned.For example,
// {"a": 10, "b": 20} String code = "{\"a\": 10, \"b\": 20}"; // Evaluate directly. Viv.KeyValue<Long>[] pairs = Viv.getKeyValueLongs(code); for (Viv.KeyValue<Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: 20 } // Evaluate result. Result result = Viv.run(code); pairs = Viv.getKeyValueLongs(result); for (Viv.KeyValue<Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: 20 } // Whole values are lost even if there is only one foreign object. code = "{\"a\": 10, \"b\": null}"; // replace pairs = Viv.getKeyValueLongs(code); System.out.println(pairs == null); // true code = "{\"a\": 10, \"b\": true}"; // replace pairs = Viv.getKeyValueLongs(code); System.out.println(pairs == null); // truegetKeyValueLongOrNulls(Object...)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Long>value- Returns:
- an array of key-value pairs as
KeyValue<Long>[].nullif evaluation is failed or the evaluated result is notHashMap<String, Long>.
-
getKeyValueLongs
public static Viv.KeyValue<Long> @Nullable [] getKeyValueLongs(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array. All values are expected as Long. When other is given,nullis returned.For example,
// {"a": 10, "b": 20} String[] codes = {"\"a\": 10", "\"b\": 20"}; // Evaluate directly. Viv.KeyValue<Long>[] pairs = Viv.getKeyValueLongs(codes, null); for (Viv.KeyValue<Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: 20 } // Evaluate result. Result result = Viv.run(codes, null); pairs = Viv.getKeyValueLongs(result); for (Viv.KeyValue<Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: 20 } // Whole values are lost even if there is only one foreign object. codes[1] = "\"b\": null"; // replace pairs = Viv.getKeyValueLongs(codes, null); System.out.println(pairs == null); // true codes[1] = "\"b\": true"; // replace pairs = Viv.getKeyValueLongs(codes, null); System.out.println(pairs == null); // truegetKeyValueLongOrNulls(Object[], Config)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Long>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<Long>[].nullif evaluation is failed or the evaluated result is notHashMap<String, Long>.
-
getKeyValueLongsEx
public static Viv.KeyValue<Long>[] getKeyValueLongsEx(@Nullable Object... objects) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Long. When other is given, exception is thrown.For example,
// {"a": 10, "b": 20} String code = "{\"a\": 10, \"b\": 20}"; // Evaluate directly. Viv.KeyValue<Long>[] pairs = Viv.getKeyValueLongsEx(code); for (Viv.KeyValue<Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: 20 } // Evaluate result. Object object = Viv.runEx(code); pairs = Viv.getKeyValueLongsEx(object); for (Viv.KeyValue<Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: 20 } // Whole values are lost even if there is only one foreign object. code = "{\"a\": 10, \"b\": null}"; // replace pairs = Viv.getKeyValueLongsEx(code); // Exception is thrown. code = "{\"a\": 10, \"b\": true}"; // replace pairs = Viv.getKeyValueLongsEx(code); // Exception is thrown.getKeyValueLongOrNullsEx(Object...)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Long>value- Returns:
- an array of key-value pairs as
KeyValue<Long>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, Long>.
-
getKeyValueLongsEx
public static Viv.KeyValue<Long>[] getKeyValueLongsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Long. When other is given, exception is thrown.For example,
// {"a": 10, "b": 20} String[] codes = {"\"a\": 10", "\"b\": 20"}; // Evaluate directly. Viv.KeyValue<Long>[] pairs = Viv.getKeyValueLongsEx(codes, null); for (Viv.KeyValue<Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: 20 } // Evaluate result. Object object = Viv.runEx(codes, null); pairs = Viv.getKeyValueLongsEx(object); for (Viv.KeyValue<Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: 20 } // Whole values are lost even if there is only one foreign object. codes[1] = "\"b\": null"; // replace pairs = Viv.getKeyValueLongsEx(codes, null); // Exception is thrown. codes[1] = "\"b\": true"; // replace pairs = Viv.getKeyValueLongsEx(codes, null); // Exception is thrown.getKeyValueLongOrNullsEx(Object[], Config)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Long>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<Long>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, Long>.
-
getKeyValueLongOrNulls
public static Viv.KeyValue<@Nullable Long> @Nullable [] getKeyValueLongOrNulls(@Nullable Object... objects) Gets key-value pairs as an array. All values are expected as Long. When other is given, it is replaced withnull.For example,
// {"a": 10, "b": null} String code = "{\"a\": 10, \"b\": null}"; // Evaluate directly. Viv.KeyValue<@Nullable Long>[] pairs = Viv.getKeyValueLongOrNulls(code); for (Viv.KeyValue<@Nullable Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null } // Evaluate result. Result result = Viv.run(code); pairs = Viv.getKeyValueLongOrNulls(result); for (Viv.KeyValue<@Nullable Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null } // Evaluate another value directly. pairs = Viv.getKeyValueLongOrNulls("{\"a\": 10, \"b\": true}"); for (Viv.KeyValue<@Nullable Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Long>value- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Long>[].nullif evaluation is failed or the evaluated result is notHashMap<String, @Nullable Long>.
-
getKeyValueLongOrNulls
public static Viv.KeyValue<@Nullable Long> @Nullable [] getKeyValueLongOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array. All values are expected as Long. When other is given, it is replaced withnull.For example,
// {"a": 10, "b": null} String[] codes = {"\"a\": 10", "\"b\": null"}; // Evaluate directly. Viv.KeyValue<@Nullable Long>[] pairs = Viv.getKeyValueLongOrNulls(codes, null); for (Viv.KeyValue<@Nullable Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null } // Evaluate result. Result result = Viv.run(codes, null); pairs = Viv.getKeyValueLongOrNulls(result); for (Viv.KeyValue<@Nullable Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null } // Evaluate another value directly. codes[1] = "\"b\": true"; // replace pairs = Viv.getKeyValueLongOrNulls(codes, null); for (Viv.KeyValue<@Nullable Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Long>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Long>[].nullif evaluation is failed or the evaluated result is notHashMap<String, @Nullable Long>.
-
getKeyValueLongOrNullsEx
public static Viv.KeyValue<@Nullable Long>[] getKeyValueLongOrNullsEx(@Nullable Object... objects) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Long. When other is given, it is replaced withnull.For example,
// {"a": 10, "b": null} String code = "{\"a\": 10, \"b\": null}"; // Evaluate directly. Viv.KeyValue<@Nullable Long>[] pairs = Viv.getKeyValueLongOrNullsEx(code); for (Viv.KeyValue<@Nullable Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null } // Evaluate result. Object object = Viv.runEx(code); pairs = Viv.getKeyValueLongOrNullsEx(object); for (Viv.KeyValue<@Nullable Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null } // Evaluate another value directly. pairs = Viv.getKeyValueLongOrNullsEx("{\"a\": 10, \"b\": true}"); for (Viv.KeyValue<@Nullable Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Long>value- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Long>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, @Nullable Long>.
-
getKeyValueLongOrNullsEx
public static Viv.KeyValue<@Nullable Long>[] getKeyValueLongOrNullsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Long. When other is given, it is replaced withnull.For example,
// {"a": 10, "b": null} String[] codes = {"\"a\": 10", "\"b\": null"}; // Evaluate directly. Viv.KeyValue<@Nullable Long>[] pairs = Viv.getKeyValueLongOrNullsEx(codes, null); for (Viv.KeyValue<@Nullable Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null } // Evaluate result. Object object = Viv.runEx(codes, null); pairs = Viv.getKeyValueLongOrNullsEx(object); for (Viv.KeyValue<@Nullable Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null } // Evaluate another value directly. codes[1] = "\"b\": true"; // replace pairs = Viv.getKeyValueLongOrNullsEx(codes, null); for (Viv.KeyValue<@Nullable Long> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 10, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Long>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Long>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, @Nullable Long>.
-
getKeyValueFloats
Gets key-value pairs as an array. All values are expected as Float. When other is given,nullis returned.For example,
// {"a": 1.0, "b": 2.5} String code = "{\"a\": 1.0, \"b\": 2.5}"; // Evaluate directly. Viv.KeyValue<Float>[] pairs = Viv.getKeyValueFloats(code); for (Viv.KeyValue<Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: 2.5 } // Evaluate result. Result result = Viv.run(code); pairs = Viv.getKeyValueFloats(result); for (Viv.KeyValue<Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: 2.5 } // Whole values are lost even if there is only one foreign object. code = "{\"a\": 1.0, \"b\": null}"; // replace pairs = Viv.getKeyValueFloats(code); System.out.println(pairs == null); // true code = "{\"a\": 1.0, \"b\": true}"; // replace pairs = Viv.getKeyValueFloats(code); System.out.println(pairs == null); // truegetKeyValueFloatOrNulls(Object...)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Float>value- Returns:
- an array of key-value pairs as
KeyValue<Float>[].nullif evaluation is failed or the evaluated result is notHashMap<String, Float>.
-
getKeyValueFloats
public static Viv.KeyValue<Float> @Nullable [] getKeyValueFloats(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array. All values are expected as Float. When other is given,nullis returned.For example,
// {"a": 1.0, "b": 2.5} String[] codes = {"\"a\": 1.0", "\"b\": 2.5"}; // Evaluate directly. Viv.KeyValue<Float>[] pairs = Viv.getKeyValueFloats(codes, null); for (Viv.KeyValue<Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: 2.5 } // Evaluate result. Result result = Viv.run(codes, null); pairs = Viv.getKeyValueFloats(result); for (Viv.KeyValue<Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: 2.5 } // Whole values are lost even if there is only one foreign object. codes[1] = "\"b\": null"; // replace pairs = Viv.getKeyValueFloats(codes, null); System.out.println(pairs == null); // true codes[1] = "\"b\": true"; // replace pairs = Viv.getKeyValueFloats(codes, null); System.out.println(pairs == null); // truegetKeyValueFloatOrNulls(Object[], Config)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Float>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<Float>[].nullif evaluation is failed or the evaluated result is notHashMap<String, Float>.
-
getKeyValueFloatsEx
public static Viv.KeyValue<Float>[] getKeyValueFloatsEx(@Nullable Object... objects) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Float. When other is given, exception is thrown.For example,
// {"a": 1.0, "b": 2.5} String code = "{\"a\": 1.0, \"b\": 2.5}"; // Evaluate directly. Viv.KeyValue<Float>[] pairs = Viv.getKeyValueFloatsEx(code); for (Viv.KeyValue<Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: 2.5 } // Evaluate result. Object object = Viv.runEx(code); pairs = Viv.getKeyValueFloatsEx(object); for (Viv.KeyValue<Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: 2.5 } // Whole values are lost even if there is only one foreign object. code = "{\"a\": 1.0, \"b\": null}"; // replace pairs = Viv.getKeyValueFloatsEx(code); // Exception is thrown. code = "{\"a\": 1.0, \"b\": true}"; // replace pairs = Viv.getKeyValueFloatsEx(code); // Exception is thrown.getKeyValueFloatOrNullsEx(Object...)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Float>value- Returns:
- an array of key-value pairs as
KeyValue<Float>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, Float>.
-
getKeyValueFloatsEx
public static Viv.KeyValue<Float>[] getKeyValueFloatsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Float. When other is given, exception is thrown.For example,
// {"a": 1.0, "b": 2.5} String[] codes = {"\"a\": 1.0", "\"b\": 2.5"}; // Evaluate directly. Viv.KeyValue<Float>[] pairs = Viv.getKeyValueFloatsEx(codes, null); for (Viv.KeyValue<Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: 2.5 } // Evaluate result. Object object = Viv.runEx(codes, null); pairs = Viv.getKeyValueFloatsEx(object); for (Viv.KeyValue<Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: 2.5 } // Whole values are lost even if there is only one foreign object. codes[1] = "\"b\": null"; // replace pairs = Viv.getKeyValueFloatsEx(codes, null); // Exception is thrown. codes[1] = "\"b\": true"; // replace pairs = Viv.getKeyValueFloatsEx(codes, null); // Exception is thrown.getKeyValueFloatOrNullsEx(Object[], Config)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Float>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<Float>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, Float>.
-
getKeyValueFloatOrNulls
public static Viv.KeyValue<@Nullable Float> @Nullable [] getKeyValueFloatOrNulls(@Nullable Object... objects) Gets key-value pairs as an array. All values are expected as Float. When other is given, it is replaced withnull.For example,
// {"a": 1.0, "b": null} String code = "{\"a\": 1.0, \"b\": null}"; // Evaluate directly. Viv.KeyValue<@Nullable Float>[] pairs = Viv.getKeyValueFloatOrNulls(code); for (Viv.KeyValue<@Nullable Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null } // Evaluate result. Result result = Viv.run(code); pairs = Viv.getKeyValueFloatOrNulls(result); for (Viv.KeyValue<@Nullable Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null } // Evaluate another value directly. pairs = Viv.getKeyValueFloatOrNulls("{\"a\": 1.0, \"b\": true}"); for (Viv.KeyValue<@Nullable Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Float>value- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Float>[].nullif evaluation is failed or the evaluated result is notHashMap<String, @Nullable Float>.
-
getKeyValueFloatOrNulls
public static Viv.KeyValue<@Nullable Float> @Nullable [] getKeyValueFloatOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array. All values are expected as Float. When other is given, it is replaced withnull.For example,
// {"a": 1.0, "b": null} String[] codes = {"\"a\": 1.0", "\"b\": null"}; // Evaluate directly. Viv.KeyValue<@Nullable Float>[] pairs = Viv.getKeyValueFloatOrNulls(codes, null); for (Viv.KeyValue<@Nullable Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null } // Evaluate result. Result result = Viv.run(codes, null); pairs = Viv.getKeyValueFloatOrNulls(result); for (Viv.KeyValue<@Nullable Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null } // Evaluate another value directly. codes[1] = "\"b\": true"; // replace pairs = Viv.getKeyValueFloatOrNulls(codes, null); for (Viv.KeyValue<@Nullable Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Float>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Float>[].nullif evaluation is failed or the evaluated result is notHashMap<String, @Nullable Float>.
-
getKeyValueFloatOrNullsEx
public static Viv.KeyValue<@Nullable Float>[] getKeyValueFloatOrNullsEx(@Nullable Object... objects) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Float. When other is given, it is replaced withnull.For example,
// {"a": 1.0, "b": null} String code = "{\"a\": 1.0, \"b\": null}"; // Evaluate directly. Viv.KeyValue<@Nullable Float>[] pairs = Viv.getKeyValueFloatOrNullsEx(code); for (Viv.KeyValue<@Nullable Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null } // Evaluate result. Object object = Viv.runEx(code); pairs = Viv.getKeyValueFloatOrNullsEx(object); for (Viv.KeyValue<@Nullable Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null } // Evaluate another value directly. pairs = Viv.getKeyValueFloatOrNullsEx("{\"a\": 1.0, \"b\": true}"); for (Viv.KeyValue<@Nullable Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Float>value- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Float>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, @Nullable Float>.
-
getKeyValueFloatOrNullsEx
public static Viv.KeyValue<@Nullable Float>[] getKeyValueFloatOrNullsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Float. When other is given, it is replaced withnull.For example,
// {"a": 1.0, "b": null} String[] codes = {"\"a\": 1.0", "\"b\": null"}; // Evaluate directly. Viv.KeyValue<@Nullable Float>[] pairs = Viv.getKeyValueFloatOrNullsEx(codes, null); for (Viv.KeyValue<@Nullable Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null } // Evaluate result. Object object = Viv.runEx(codes, null); pairs = Viv.getKeyValueFloatOrNullsEx(object); for (Viv.KeyValue<@Nullable Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null } // Evaluate another value directly. codes[1] = "\"b\": true"; // replace pairs = Viv.getKeyValueFloatOrNullsEx(codes, null); for (Viv.KeyValue<@Nullable Float> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Float>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Float>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, @Nullable Float>.
-
getKeyValueDoubles
Gets key-value pairs as an array. All values are expected as Double. When other is given,nullis returned.For example,
// {"a": 1.0, "b": 2.5} String code = "{\"a\": 1.0, \"b\": 2.5}"; // Evaluate directly. Viv.KeyValue<Double>[] pairs = Viv.getKeyValueDoubles(code); for (Viv.KeyValue<Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: 2.5 } // Evaluate result. Result result = Viv.run(code); pairs = Viv.getKeyValueDoubles(result); for (Viv.KeyValue<Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: 2.5 } // Whole values are lost even if there is only one foreign object. code = "{\"a\": 1.0, \"b\": null}"; // replace pairs = Viv.getKeyValueDoubles(code); System.out.println(pairs == null); // true code = "{\"a\": 1.0, \"b\": true}"; // replace pairs = Viv.getKeyValueDoubles(code); System.out.println(pairs == null); // truegetKeyValueDoubleOrNulls(Object...)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Double>value- Returns:
- an array of key-value pairs as
KeyValue<Double>[].nullif evaluation is failed or the evaluated result is notHashMap<String, Double>.
-
getKeyValueDoubles
public static Viv.KeyValue<Double> @Nullable [] getKeyValueDoubles(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array. All values are expected as Double. When other is given,nullis returned.For example,
// {"a": 1.0, "b": 2.5} String[] codes = {"\"a\": 1.0", "\"b\": 2.5"}; // Evaluate directly. Viv.KeyValue<Double>[] pairs = Viv.getKeyValueDoubles(codes, null); for (Viv.KeyValue<Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: 2.5 } // Evaluate result. Result result = Viv.run(codes, null); pairs = Viv.getKeyValueDoubles(result); for (Viv.KeyValue<Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: 2.5 } // Whole values are lost even if there is only one foreign object. codes[1] = "\"b\": null"; // replace pairs = Viv.getKeyValueDoubles(codes, null); System.out.println(pairs == null); // true codes[1] = "\"b\": true"; // replace pairs = Viv.getKeyValueDoubles(codes, null); System.out.println(pairs == null); // truegetKeyValueDoubleOrNulls(Object[], Config)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Double>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<Double>[].nullif evaluation is failed or the evaluated result is notHashMap<String, Double>.
-
getKeyValueDoublesEx
public static Viv.KeyValue<Double>[] getKeyValueDoublesEx(@Nullable Object... objects) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Double. When other is given, exception is thrown.For example,
// {"a": 1.0, "b": 2.5} String code = "{\"a\": 1.0, \"b\": 2.5}"; // Evaluate directly. Viv.KeyValue<Double>[] pairs = Viv.getKeyValueDoublesEx(code); for (Viv.KeyValue<Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: 2.5 } // Evaluate result. Object object = Viv.runEx(code); pairs = Viv.getKeyValueDoublesEx(object); for (Viv.KeyValue<Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: 2.5 } // Whole values are lost even if there is only one foreign object. code = "{\"a\": 1.0, \"b\": null}"; // replace pairs = Viv.getKeyValueDoublesEx(code); // Exception is thrown. code = "{\"a\": 1.0, \"b\": true}"; // replace pairs = Viv.getKeyValueDoublesEx(code); // Exception is thrown.getKeyValueDoubleOrNullsEx(Object...)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Double>value- Returns:
- an array of key-value pairs as
KeyValue<Double>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, Double>.
-
getKeyValueDoublesEx
public static Viv.KeyValue<Double>[] getKeyValueDoublesEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Double. When other is given, exception is thrown.For example,
// {"a": 1.0, "b": 2.5} String[] codes = {"\"a\": 1.0", "\"b\": 2.5"}; // Evaluate directly. Viv.KeyValue<Double>[] pairs = Viv.getKeyValueDoublesEx(codes, null); for (Viv.KeyValue<Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: 2.5 } // Evaluate result. Object object = Viv.runEx(codes, null); pairs = Viv.getKeyValueDoublesEx(object); for (Viv.KeyValue<Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: 2.5 } // Whole values are lost even if there is only one foreign object. codes[1] = "\"b\": null"; // replace pairs = Viv.getKeyValueDoublesEx(codes, null); // Exception is thrown. codes[1] = "\"b\": true"; // replace pairs = Viv.getKeyValueDoublesEx(codes, null); // Exception is thrown.getKeyValueDoubleOrNullsEx(Object[], Config)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Double>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<Double>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, Double>.
-
getKeyValueDoubleOrNulls
public static Viv.KeyValue<@Nullable Double> @Nullable [] getKeyValueDoubleOrNulls(@Nullable Object... objects) Gets key-value pairs as an array. All values are expected as Double. When other is given, it is replaced withnull.For example,
// {"a": 1.0, "b": null} String code = "{\"a\": 1.0, \"b\": null}"; // Evaluate directly. Viv.KeyValue<@Nullable Double>[] pairs = Viv.getKeyValueDoubleOrNulls(code); for (Viv.KeyValue<@Nullable Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null } // Evaluate result. Result result = Viv.run(code); pairs = Viv.getKeyValueDoubleOrNulls(result); for (Viv.KeyValue<@Nullable Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null } // Evaluate another value directly. pairs = Viv.getKeyValueDoubleOrNulls("{\"a\": 1.0, \"b\": true}"); for (Viv.KeyValue<@Nullable Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Double>value- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Double>[].nullif evaluation is failed or the evaluated result is notHashMap<String, @Nullable Double>.
-
getKeyValueDoubleOrNulls
public static Viv.KeyValue<@Nullable Double> @Nullable [] getKeyValueDoubleOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array. All values are expected as Double. When other is given, it is replaced withnull.For example,
// {"a": 1.0, "b": null} String[] codes = {"\"a\": 1.0", "\"b\": null"}; // Evaluate directly. Viv.KeyValue<@Nullable Double>[] pairs = Viv.getKeyValueDoubleOrNulls(codes, null); for (Viv.KeyValue<@Nullable Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null } // Evaluate result. Result result = Viv.run(codes, null); pairs = Viv.getKeyValueDoubleOrNulls(result); for (Viv.KeyValue<@Nullable Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null } // Evaluate another value directly. codes[1] = "\"b\": true"; // replace pairs = Viv.getKeyValueDoubleOrNulls(codes, null); for (Viv.KeyValue<@Nullable Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Double>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Double>[].nullif evaluation is failed or the evaluated result is notHashMap<String, @Nullable Double>.
-
getKeyValueDoubleOrNullsEx
public static Viv.KeyValue<@Nullable Double>[] getKeyValueDoubleOrNullsEx(@Nullable Object... objects) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Double. When other is given, it is replaced withnull.For example,
// {"a": 1.0, "b": null} String code = "{\"a\": 1.0, \"b\": null}"; // Evaluate directly. Viv.KeyValue<@Nullable Double>[] pairs = Viv.getKeyValueDoubleOrNullsEx(code); for (Viv.KeyValue<@Nullable Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null } // Evaluate result. Object object = Viv.runEx(code); pairs = Viv.getKeyValueDoubleOrNullsEx(object); for (Viv.KeyValue<@Nullable Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null } // Evaluate another value directly. pairs = Viv.getKeyValueDoubleOrNullsEx("{\"a\": 1.0, \"b\": true}"); for (Viv.KeyValue<@Nullable Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Double>value- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Double>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, @Nullable Double>.
-
getKeyValueDoubleOrNullsEx
public static Viv.KeyValue<@Nullable Double>[] getKeyValueDoubleOrNullsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Double. When other is given, it is replaced withnull.For example,
// {"a": 1.0, "b": null} String[] codes = {"\"a\": 1.0", "\"b\": null"}; // Evaluate directly. Viv.KeyValue<@Nullable Double>[] pairs = Viv.getKeyValueDoubleOrNullsEx(codes, null); for (Viv.KeyValue<@Nullable Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null } // Evaluate result. Object object = Viv.runEx(codes, null); pairs = Viv.getKeyValueDoubleOrNullsEx(object); for (Viv.KeyValue<@Nullable Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null } // Evaluate another value directly. codes[1] = "\"b\": true"; // replace pairs = Viv.getKeyValueDoubleOrNullsEx(codes, null); for (Viv.KeyValue<@Nullable Double> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: 1.0, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Double>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Double>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, @Nullable Double>.
-
getKeyValueStrings
Gets key-value pairs as an array. All values are expected as String. When other is given,nullis returned.For example,
// {"a": "alpha", "b": "beta"} String code = "{\"a\": \"alpha\", \"b\": \"beta\"}"; // Evaluate directly. Viv.KeyValue<String>[] pairs = Viv.getKeyValueStrings(code); for (Viv.KeyValue<String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: beta } // Evaluate result. Result result = Viv.run(code); pairs = Viv.getKeyValueStrings(result); for (Viv.KeyValue<String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: beta } // Whole values are lost even if there is only one foreign object. code = "{\"a\": \"alpha\", \"b\": null}"; // replace pairs = Viv.getKeyValueStrings(code); System.out.println(pairs == null); // true code = "{\"a\": \"alpha\", \"b\": 10}"; // replace pairs = Viv.getKeyValueStrings(code); System.out.println(pairs == null); // truegetKeyValueStringOrNulls(Object...)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, String>value- Returns:
- an array of key-value pairs as
KeyValue<String>[].nullif evaluation is failed or the evaluated result is notHashMap<String, String>.
-
getKeyValueStrings
public static Viv.KeyValue<String> @Nullable [] getKeyValueStrings(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array. All values are expected as String. When other is given,nullis returned.For example,
// {"a": "alpha", "b": "beta"} String[] codes = {"\"a\": \"alpha\"", "\"b\": \"beta\""}; // Evaluate directly. Viv.KeyValue<String>[] pairs = Viv.getKeyValueStrings(codes, null); for (Viv.KeyValue<String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: beta } // Evaluate result. Result result = Viv.run(codes, null); pairs = Viv.getKeyValueStrings(result); for (Viv.KeyValue<String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: beta } // Whole values are lost even if there is only one foreign object. codes[1] = "\"b\": null"; // replace pairs = Viv.getKeyValueStrings(codes, null); System.out.println(pairs == null); // true codes[1] = "\"b\": 10"; // replace pairs = Viv.getKeyValueStrings(codes, null); System.out.println(pairs == null); // truegetKeyValueStringOrNulls(Object[], Config)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, String>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<String>[].nullif evaluation is failed or the evaluated result is notHashMap<String, String>.
-
getKeyValueStringsEx
public static Viv.KeyValue<String>[] getKeyValueStringsEx(@Nullable Object... objects) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as String. When other is given, exception is thrown.For example,
// {"a": "alpha", "b": "beta"} String code = "{\"a\": \"alpha\", \"b\": \"beta\"}"; // Evaluate directly. Viv.KeyValue<String>[] pairs = Viv.getKeyValueStringsEx(code); for (Viv.KeyValue<String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: beta } // Evaluate result. Object object = Viv.runEx(code); pairs = Viv.getKeyValueStringsEx(object); for (Viv.KeyValue<String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: beta } // Whole values are lost even if there is only one foreign object. code = "{\"a\": \"alpha\", \"b\": null}"; // replace pairs = Viv.getKeyValueStringsEx(code); // Exception is thrown. code = "{\"a\": \"alpha\", \"b\": 10}"; // replace pairs = Viv.getKeyValueStringsEx(code); // Exception is thrown.getKeyValueStringOrNullsEx(Object...)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, String>value- Returns:
- an array of key-value pairs as
KeyValue<String>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, String>.
-
getKeyValueStringsEx
public static Viv.KeyValue<String>[] getKeyValueStringsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as String. When other is given, exception is thrown.For example,
// {"a": "alpha", "b": "beta"} String[] codes = {"\"a\": \"alpha\"", "\"b\": \"beta\""}; // Evaluate directly. Viv.KeyValue<String>[] pairs = Viv.getKeyValueStringsEx(codes, null); for (Viv.KeyValue<String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: beta } // Evaluate result. Object object = Viv.runEx(codes, null); pairs = Viv.getKeyValueStringsEx(object); for (Viv.KeyValue<String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: beta } // Whole values are lost even if there is only one foreign object. codes[1] = "\"b\": null"; // replace pairs = Viv.getKeyValueStringsEx(codes, null); // Exception is thrown. codes[1] = "\"b\": 10"; // replace pairs = Viv.getKeyValueStringsEx(codes, null); // Exception is thrown.getKeyValueStringOrNullsEx(Object[], Config)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, String>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<String>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, String>.
-
getKeyValueStringOrNulls
public static Viv.KeyValue<@Nullable String> @Nullable [] getKeyValueStringOrNulls(@Nullable Object... objects) Gets key-value pairs as an array. All values are expected as String. When other is given, it is replaced withnull.For example,
// {"a": "alpha", "b": null} String code = "{\"a\": \"alpha\", \"b\": null}"; // Evaluate directly. Viv.KeyValue<@Nullable String>[] pairs = Viv.getKeyValueStringOrNulls(code); for (Viv.KeyValue<@Nullable String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null } // Evaluate result. Result result = Viv.run(code); pairs = Viv.getKeyValueStringOrNulls(result); for (Viv.KeyValue<@Nullable String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null } // Evaluate another value directly. pairs = Viv.getKeyValueStringOrNulls("{\"a\": \"alpha\", \"b\": 10}"); for (Viv.KeyValue<@Nullable String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable String>value- Returns:
- an array of key-value pairs as
KeyValue<@Nullable String>[].nullif evaluation is failed or the evaluated result is notHashMap<String, @Nullable String>.
-
getKeyValueStringOrNulls
public static Viv.KeyValue<@Nullable String> @Nullable [] getKeyValueStringOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array. All values are expected as String. When other is given, it is replaced withnull.For example,
// {"a": "alpha", "b": null} String[] codes = {"\"a\": \"alpha\"", "\"b\": null"}; // Evaluate directly. Viv.KeyValue<@Nullable String>[] pairs = Viv.getKeyValueStringOrNulls(codes, null); for (Viv.KeyValue<@Nullable String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null } // Evaluate result. Result result = Viv.run(codes, null); pairs = Viv.getKeyValueStringOrNulls(result); for (Viv.KeyValue<@Nullable String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null } // Evaluate another value directly. codes[1] = "\"b\": 10"; // replace pairs = Viv.getKeyValueStringOrNulls(codes, null); for (Viv.KeyValue<@Nullable String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable String>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<@Nullable String>[].nullif evaluation is failed or the evaluated result is notHashMap<String, @Nullable String>.
-
getKeyValueStringOrNullsEx
public static Viv.KeyValue<@Nullable String>[] getKeyValueStringOrNullsEx(@Nullable Object... objects) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as String. When other is given, it is replaced withnull.For example,
// {"a": "alpha", "b": null} String code = "{\"a\": \"alpha\", \"b\": null}"; // Evaluate directly. Viv.KeyValue<@Nullable String>[] pairs = Viv.getKeyValueStringOrNullsEx(code); for (Viv.KeyValue<@Nullable String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null } // Evaluate result. Object object = Viv.runEx(code); pairs = Viv.getKeyValueStringOrNullsEx(object); for (Viv.KeyValue<@Nullable String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null } // Evaluate another value directly. pairs = Viv.getKeyValueStringOrNullsEx("{\"a\": \"alpha\", \"b\": 10}"); for (Viv.KeyValue<@Nullable String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable String>value- Returns:
- an array of key-value pairs as
KeyValue<@Nullable String>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, @Nullable String>.
-
getKeyValueStringOrNullsEx
public static Viv.KeyValue<@Nullable String>[] getKeyValueStringOrNullsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as String. When other is given, it is replaced withnull.For example,
// {"a": "alpha", "b": null} String[] codes = {"\"a\": \"alpha\"", "\"b\": null"}; // Evaluate directly. Viv.KeyValue<@Nullable String>[] pairs = Viv.getKeyValueStringOrNullsEx(codes, null); for (Viv.KeyValue<@Nullable String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null } // Evaluate result. Object object = Viv.runEx(codes, null); pairs = Viv.getKeyValueStringOrNullsEx(object); for (Viv.KeyValue<@Nullable String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null } // Evaluate another value directly. codes[1] = "\"b\": 10"; // replace pairs = Viv.getKeyValueStringOrNullsEx(codes, null); for (Viv.KeyValue<@Nullable String> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable String>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<@Nullable String>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, @Nullable String>.
-
getKeyValueObjects
Gets key-value pairs as an array. All values are expected as Object. When there isnull,nullis returned as the whole returned value.For example,
// {"a": "alpha", "b": 100} String code = "{\"a\": \"alpha\", \"b\": 100}"; // Evaluate directly. Viv.KeyValue<Object>[] pairs = Viv.getKeyValueObjects(code); for (Viv.KeyValue<Object> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: 100 } // Evaluate result. Result result = Viv.run(code); pairs = Viv.getKeyValueObjects(result); for (Viv.KeyValue<Object> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: 100 } // Whole values are lost even if there is only one foreign object. code = "{\"a\": \"alpha\", \"b\": null}"; // replace pairs = Viv.getKeyValueObjects(code); System.out.println(pairs == null); // truegetKeyValueObjectOrNulls(Object...)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Object>value- Returns:
- an array of key-value pairs as
KeyValue<Object>[].nullif evaluation is failed or the evaluated result is notHashMap<String, Object>.
-
getKeyValueObjects
public static Viv.KeyValue<Object> @Nullable [] getKeyValueObjects(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array. All values are expected as Object. When there isnull,nullis returned as the whole returned value.For example,
// {"a": "alpha", "b": 100} String[] codes = {"\"a\": \"alpha\"", "\"b\": 100"}; // Evaluate directly. Viv.KeyValue<Object>[] pairs = Viv.getKeyValueObjects(codes, null); for (Viv.KeyValue<Object> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: 100 } // Evaluate result. Result result = Viv.run(codes, null); pairs = Viv.getKeyValueObjects(result); for (Viv.KeyValue<Object> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: 100 } // Whole values are lost even if there is only one foreign object. codes[1] = "\"b\": null"; // replace pairs = Viv.getKeyValueObjects(codes, null); System.out.println(pairs == null); // truegetKeyValueObjectOrNulls(Object[], Config)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Object>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<Object>[].nullif evaluation is failed or the evaluated result is notHashMap<String, Object>.
-
getKeyValueObjectsEx
public static Viv.KeyValue<Object>[] getKeyValueObjectsEx(@Nullable Object... objects) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Object. When there isnull, exception is thrown.For example,
// {"a": "alpha", "b": 100} String code = "{\"a\": \"alpha\", \"b\": 100}"; // Evaluate directly. Viv.KeyValue<Object>[] pairs = Viv.getKeyValueObjectsEx(code); for (Viv.KeyValue<Object> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: 100 } // Evaluate result. Result result = Viv.run(code); pairs = Viv.getKeyValueObjectsEx(result); for (Viv.KeyValue<Object> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: 100 } // Whole values are lost even if there is only one foreign object. code = "{\"a\": \"alpha\", \"b\": null}"; // replace pairs = Viv.getKeyValueObjectsEx(code); // Exception is thrown.getKeyValueObjectOrNullsEx(Object...)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Object>value- Returns:
- an array of key-value pairs as
KeyValue<Object>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, Object>.
-
getKeyValueObjectsEx
public static Viv.KeyValue<Object>[] getKeyValueObjectsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Object. When there isnull, exception is thrown.For example,
// {"a": "alpha", "b": 100} String[] codes = {"\"a\": \"alpha\"", "\"b\": 100"}; // Evaluate directly. Viv.KeyValue<Object>[] pairs = Viv.getKeyValueObjectsEx(codes, null); for (Viv.KeyValue<Object> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: 100 } // Evaluate result. Result result = Viv.run(codes, null); pairs = Viv.getKeyValueObjectsEx(result); for (Viv.KeyValue<Object> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: 100 } // Whole values are lost even if there is only one foreign object. codes[1] = "\"b\": null"; // replace pairs = Viv.getKeyValueObjectsEx(codes, null); // Exception is thrown.getKeyValueObjectOrNullsEx(Object[], Config)is suitable if you want not to lost whole values.- Parameters:
objects- object that may be aHashMap<String, Object>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<Object>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, Object>.
-
getKeyValueObjectOrNulls
public static Viv.KeyValue<@Nullable Object> @Nullable [] getKeyValueObjectOrNulls(@Nullable Object... objects) Gets key-value pairs as an array. All values are expected as Object. Even if there isnull, it is permitted.For example,
// {"a": "alpha", "b": null} String code = "{\"a\": \"alpha\", \"b\": null}"; // Evaluate directly. Viv.KeyValue<@Nullable Object>[] pairs = Viv.getKeyValueObjectOrNulls(code); for (Viv.KeyValue<@Nullable Object> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null } // Evaluate result. Result result = Viv.run(code); pairs = Viv.getKeyValueObjectOrNulls(result); for (Viv.KeyValue<@Nullable Object> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Object>value- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Object>[].nullif evaluation is failed or the evaluated result is notHashMap<String, @Nullable Object>.
-
getKeyValueObjectOrNulls
public static Viv.KeyValue<@Nullable Object> @Nullable [] getKeyValueObjectOrNulls(@Nullable Object[] objects, @Nullable Config config) Gets key-value pairs as an array. All values are expected as Object. Even if there isnull, it is permitted.For example,
// {"a": "alpha", "b": null} String[] codes = {"\"a\": \"alpha\"", "\"b\": null"}; // Evaluate directly. Viv.KeyValue<@Nullable Object>[] pairs = Viv.getKeyValueObjectOrNulls(codes, null); for (Viv.KeyValue<@Nullable Object> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null } // Evaluate result. Result result = Viv.run(codes, null); pairs = Viv.getKeyValueObjectOrNulls(result); for (Viv.KeyValue<@Nullable Object> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Object>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Object>[].nullif evaluation is failed or the evaluated result is notHashMap<String, @Nullable Object>.
-
getKeyValueObjectOrNullsEx
public static Viv.KeyValue<@Nullable Object>[] getKeyValueObjectOrNullsEx(@Nullable Object... objects) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Object. Even if there isnull, it is permitted.For example,
// {"a": "alpha", "b": null} String code = "{\"a\": \"alpha\", \"b\": null}"; // Evaluate directly. Viv.KeyValue<@Nullable Object>[] pairs = Viv.getKeyValueObjectOrNullsEx(code); for (Viv.KeyValue<@Nullable Object> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null } // Evaluate result. Result result = Viv.run(code); pairs = Viv.getKeyValueObjectOrNullsEx(result); for (Viv.KeyValue<@Nullable Object> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Object>value- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Object>[] - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, @Nullable Object>.
-
getKeyValueObjectOrNullsEx
public static Viv.KeyValue<@Nullable Object>[] getKeyValueObjectOrNullsEx(@Nullable Object[] objects, @Nullable Config config) throws VivException Gets key-value pairs as an array. (Permit exception) All values are expected as Object. Even if there isnull, it is permitted.For example,
// {"a": "alpha", "b": null} String[] codes = {"\"a\": \"alpha\"", "\"b\": null"}; // Evaluate directly. Viv.KeyValue<@Nullable Object>[] pairs = Viv.getKeyValueObjectOrNullsEx(codes, null); for (Viv.KeyValue<@Nullable Object> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null } // Evaluate result. Result result = Viv.run(codes, null); pairs = Viv.getKeyValueObjectOrNullsEx(result); for (Viv.KeyValue<@Nullable Object> pair : pairs) { System.out.println(pair.key + ": " + pair.value); // a: alpha, b: null }- Parameters:
objects- object that may be aHashMap<String, @Nullable Object>valueconfig- configuration if it is needed,nullotherwise- Returns:
- an array of key-value pairs as
KeyValue<@Nullable Object>[]. - Throws:
VivException- it is thrown if evaluation is failed or the evaluated result is notHashMap<String, @Nullable Object>.
-
makeString
Convert a value into string. Serialize a value into JSON string.- Parameters:
value- an object that may be Byte, Short, Integer, Long, Float, Double, Boolean, String,ArrayList<@Nullable Object>,HashMap<String, @Nullable Object>, ornull- Returns:
- a converted value
-
makeString
Converts a value into string. Serialize a value into JSON string.Configuration is available for Infinity and NaN (Not a Number). When it is not setting, "" (empty) is returned.
- Parameters:
value- an object that may be Byte, Short, Integer, Long, Float, Double, Boolean, String,ArrayList<@Nullable Object>,HashMap<String, @Nullable Object>, ornullconfig- configuration if needed,nullotherwise- Returns:
- a converted value
-