Package Torello.Java.JSON
Class RJArrPrimConsumerRec
- java.lang.Object
-
- Torello.Java.JSON.RJArrPrimConsumerRec
-
public class RJArrPrimConsumerRec extends java.lang.Object
RJArrBoxedConsumerRec 🠞RJArr
- ReadJsonArray
This class is a helper class, used for reading data directly from an already parsedJsonArray
instance.
PrimConsumer
- Data is sent to a Java Primitive-Consumer.
Rec
- The methods in this class produce a pre-configuredSettingsRec
instance. Re-using a Configuration-Record can speed up processing when more than oneJsonArray
needs to be handled. This record should be used in conjunction with the classProcessJsonArray
to process multipleJsonArray's
, efficiently.
Generate a Pre-ConfiguredSettingsRec
instance which can handle Java-Primitives.
This class builds on the J2EE Standard 'Glass-Fish' JSON Processor
There are several JSON Parsers available, and even more implementations for serializing and de-serializing data to/from JSON. The tool included in the J2EE is available on GitHub, and that is the one used by the Java HTML JAR Library. (See:javax.json.*
)
Primary Classes Used:JsonArray
andJsonObject
This class generates the Pre-Packaged, Pre-ConfiguredSettingsRec
instances that may be used to optimize loops. Use the records that are produced by the methods in this class in conjunction with the classProcessJsonArray
to (more efficiently) process MultipleJsonArray's
with similar characteristics.
Optimize Loops:
For each method within this class, there are actually two different variants of what is, essentially, the exact same method. Methods in this class whose name ends with the letters'Rec'
are methods that will produce what is known as a 'Settings Record', (see classSettingsRec<T, U>
).
Every one of the Json-Processing classes (in this Json Java-Package) that begin with the letters'RJArr'
are classes which iterateJsonArray's
. First, the class does some form of processing and testing to ensure that the contents of the arrays are properly converted into standard Java-Types. After the elements of aJsonArray
are successfully processed, they are then sent to either a Java-Array
, aStream
or a User-ProvidedConsumer
.
In order to guarantee that there is a homogenous algorithm for processing these array indices, only four Java 'for
-loops' have actually been written. (These loops may be easily inspected by clicking on the'Hi-Lited Source-Code'
button inside of classProcessJsonArray
). In this class, in order to differentiate between aJsonArray
which is to be converted into a Javaint[]
-Array, and one which is to be placed into a Javalong[]
-Array, a particular "Settings Record" is constructed (which "configures" the loop's body).
If only one invocation of a method is needed, then using the method that ends with'Arr'
should be perfectly sufficient! If the methods in this class are going to be invoked from inside of a loop (or invoked many times), then it would be much wiser to, first, obtain an instance of theSettingsRec
, and then invoke the Array-Processing code yourself.
In this way, generating twice as many short-lived, ephemeral, object instances (that are immediately discarded, and then collected by the Garbage-Collector) can be avoided. To do this is quite simple. Please review the documentation for the methods in this class whose name ends with'Rec'
- and look at the example code provided for how to use them.
The Loop Optimized variants of the methods in this class are, very simple, two step procedures (as opposed to just a single method invocation).- First, generate an instance of the
SettingsRec
class. Make sure to heed to Generic-Type Parameters returned by the Settings-Record Generator-Method you have called. - Second, simply call the specified Json-Array Processing method from class
ProcessJsonArray
Method Parameters
Parameter Explanation <PRIMITIVE> defaultValue
When an appropriate JFlag
-Value is included in the mask, this Default-Value will be passed to the User-Provided Consumer in whichever Error-Circumstance has occured (as per the Flag-Value Name).
This Default-Value may be requested throughJFlag
-Values such as:RD_AEX
,RD_IOB
andRD_M
(among others). The'RD'
in these Flag's Names is an abbreviation for "Return Default-Value".
The Complete List of Flags which request that this Default-Value Parameter be employed under various Error-Circumstances may be viewed in the following link. The name of each of these flags attempts identify the type of Error-Situation to which it may be applied.
Default-Value Flagsint FLAGS
A Bit-Wise Flag-Mask that provides a means for configuring the Array-Processing Logic to properly handle several types of Error-Cases & potentatial, unexpected, array contents.
A Flag-Mask of'0'
requests that any Error-Situations which occur, should they crop up while processing the array, be handled by standard means - meaning by throwing one of the germaine Exception-Class.To-<PRIMITIVE>
Function<String>
optionalUserParserThis parameter can only serve a purpose when it is used in conjunction with a JFlag
-Vaule which explicity requests that JavaString
-Values be handled by a parser (rather than causing an exception to throw).
The two flags which may be employed to signal this Handler-Behavior are:RETURN_PARSE_ON_STR
andRP_S
(the latter being merely the abbreviated variant of the former).
If neither of these flags have been AND'ed into the Flag-Mask parameter ("FLAGS"
), then any function which is passed to this parameter ("optionalUserParser"
) is wholly ignored - simply because using aString
-Parser is not a "Default Behavior of this class' Array-Processing Logic.
Hi-Lited Source-Code:- View Here: Torello/Java/JSON/RJArrPrimConsumerRec.java
- Open New Browser-Tab: Torello/Java/JSON/RJArrPrimConsumerRec.java
File Size: 17,289 Bytes Line Count: 439 '\n' Characters Found
Stateless Class:This class neither contains any program-state, nor can it be instantiated. The@StaticFunctional
Annotation may also be called 'The Spaghetti Report'.Static-Functional
classes are, essentially, C-Styled Files, without any constructors or non-static member fields. It is a concept very similar to the Java-Bean's@Stateless
Annotation.
- 1 Constructor(s), 1 declared private, zero-argument constructor
- 14 Method(s), 14 declared static
- 0 Field(s)
-
-
Method Summary
Generate a SettingsRec Instance which reads a Json-Array into a Primitive-Consumer Modifier and Type Method static SettingsRec<Boolean,Void>
booleanArr(boolean defaultValue, int FLAGS, Predicate<String> optionalUserParser)
static SettingsRec<Byte,Void>
byteArr(byte defaultValue, int FLAGS, ToByteFunction<String> optionalUserParser)
static SettingsRec<Double,Void>
doubleArr(double defaultValue, int FLAGS, ToDoubleFunction<String> optionalUserParser)
static SettingsRec<Float,Void>
floatArr(float defaultValue, int FLAGS, ToFloatFunction<String> optionalUserParser)
static SettingsRec<Integer,Void>
intArr(int defaultValue, int FLAGS, ToIntFunction<String> optionalUserParser)
static SettingsRec<Long,Void>
longArr(long defaultValue, int FLAGS, ToLongFunction<String> optionalUserParser)
static SettingsRec<Short,Void>
shortArr(short defaultValue, int FLAGS, ToShortFunction<String> optionalUserParser)
Generate a SettingsRec Instance which reads a Json-Array into a Primitive-Consumer, w/ Array-Indices Modifier and Type Method static SettingsRec<Boolean,Void>
booleanArr2(boolean defaultValue, int FLAGS, Predicate<String> optionalUserParser)
static SettingsRec<Byte,Void>
byteArr2(byte defaultValue, int FLAGS, ToByteFunction<String> optionalUserParser)
static SettingsRec<Double,Void>
doubleArr2(double defaultValue, int FLAGS, ToDoubleFunction<String> optionalUserParser)
static SettingsRec<Float,Void>
floatArr2(float defaultValue, int FLAGS, ToFloatFunction<String> optionalUserParser)
static SettingsRec<Integer,Void>
intArr2(int defaultValue, int FLAGS, ToIntFunction<String> optionalUserParser)
static SettingsRec<Long,Void>
longArr2(long defaultValue, int FLAGS, ToLongFunction<String> optionalUserParser)
static SettingsRec<Short,Void>
shortArr2(short defaultValue, int FLAGS, ToShortFunction<String> optionalUserParser)
-
-
-
Method Detail
-
intArr
public static SettingsRec<java.lang.Integer,java.lang.Void> intArr (int defaultValue, int FLAGS, java.util.function.ToIntFunction<java.lang.String> optionalUserParser)
Create a SettingsRec Instance for a Primitive-Integer ConsumerGenerates: An Integer-Retrieval Settings-Record. Auto-Boxing: Thanks to Java's Auto-Boxing & Un-Boxing the 'int'
Type is Auto-Converted to an'Integer'
TypeImportant: Java-Generics cannot assume a Primitive-Types for a Type-Parameter. Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)
Removes: Any JFlag
masks which might insert null-entries in the return-streamSee: Class JFlag
for information about parameter'FLAGS'
See: Flag JFlag.NOT_ALLOWED_RET_NULL_MASKS
for a list of all disallowed & filtered flags.Expects: The Generated Record expects a Consumer with a Lambda-Signature like: Signature void accept (int value)
Example:
// Generate a reusable, pre-configured SettingsRec instance final SettingsRec<Integer, Void> rec = RJArrPrimConsumerRec.intRec(ja, -1, 0, null); // You must provide a consumer. rec.setConsumer((int primVal) -> System.out.println(primVal); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec);
-
shortArr
public static SettingsRec<java.lang.Short,java.lang.Void> shortArr (short defaultValue, int FLAGS, ToShortFunction<java.lang.String> optionalUserParser)
Create a SettingsRec Instance for a Primitive Short-Integer ConsumerGenerates: A Short-Retrieval Settings-Record. Auto-Boxing: Thanks to Java's Auto-Boxing & Un-Boxing the 'short'
Type is Auto-Converted to an'Short'
TypeImportant: Java-Generics cannot assume a Primitive-Types for a Type-Parameter. Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)
Removes: Any JFlag
masks which might insert null-entries in the return-streamSee: Class JFlag
for information about parameter'FLAGS'
See: Flag JFlag.NOT_ALLOWED_RET_NULL_MASKS
for a list of all disallowed & filtered flags.Expects: The Generated Record expects a Consumer with a Lambda-Signature like: Signature void accept (short value)
Example:
// Generate a reusable, pre-configured SettingsRec instance final SettingsRec<Short, Void> rec = RJArrPrimConsumerRec.shortRec(ja, -1, 0, null); // You must provide a consumer. rec.setConsumer((short primVal) -> System.out.println(primVal); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec);
-
byteArr
public static SettingsRec<java.lang.Byte,java.lang.Void> byteArr (byte defaultValue, int FLAGS, ToByteFunction<java.lang.String> optionalUserParser)
Create a SettingsRec Instance for a Primitive-Byte ConsumerGenerates: A Byte-Retrieval Settings-Record. Auto-Boxing: Thanks to Java's Auto-Boxing & Un-Boxing the 'byte'
Type is Auto-Converted to an'Byte'
TypeImportant: Java-Generics cannot assume a Primitive-Types for a Type-Parameter. Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)
Removes: Any JFlag
masks which might insert null-entries in the return-streamSee: Class JFlag
for information about parameter'FLAGS'
See: Flag JFlag.NOT_ALLOWED_RET_NULL_MASKS
for a list of all disallowed & filtered flags.Expects: The Generated Record expects a Consumer with a Lambda-Signature like: Signature void accept (byte value)
Example:
// Generate a reusable, pre-configured SettingsRec instance final SettingsRec<Byte, Void> rec = RJArrPrimConsumerRec.byteRec(ja, -1, 0, null); // You must provide a consumer. rec.setConsumer((byte primVal) -> System.out.println(primVal); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec);
-
longArr
public static SettingsRec<java.lang.Long,java.lang.Void> longArr (long defaultValue, int FLAGS, java.util.function.ToLongFunction<java.lang.String> optionalUserParser)
Create a SettingsRec Instance for a Primitive Long-Integer ConsumerGenerates: A Long-Retrieval Settings-Record. Auto-Boxing: Thanks to Java's Auto-Boxing & Un-Boxing the 'long'
Type is Auto-Converted to an'Long'
TypeImportant: Java-Generics cannot assume a Primitive-Types for a Type-Parameter. Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)
Removes: Any JFlag
masks which might insert null-entries in the return-streamSee: Class JFlag
for information about parameter'FLAGS'
See: Flag JFlag.NOT_ALLOWED_RET_NULL_MASKS
for a list of all disallowed & filtered flags.Expects: The Generated Record expects a Consumer with a Lambda-Signature like: Signature void accept (long value)
Example:
// Generate a reusable, pre-configured SettingsRec instance final SettingsRec<Long, Void> rec = RJArrPrimConsumerRec.longRec(ja, -1, 0, null); // You must provide a consumer. rec.setConsumer((long primVal) -> System.out.println(primVal); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec);
-
doubleArr
public static SettingsRec<java.lang.Double,java.lang.Void> doubleArr (double defaultValue, int FLAGS, java.util.function.ToDoubleFunction<java.lang.String> optionalUserParser)
Create a SettingsRec Instance for a Primitive-Double ConsumerGenerates: A Double-Retrieval Settings-Record. Auto-Boxing: Thanks to Java's Auto-Boxing & Un-Boxing the 'double'
Type is Auto-Converted to an'Double'
TypeImportant: Java-Generics cannot assume a Primitive-Types for a Type-Parameter. Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)
Removes: Any JFlag
masks which might insert null-entries in the return-streamSee: Class JFlag
for information about parameter'FLAGS'
See: Flag JFlag.NOT_ALLOWED_RET_NULL_MASKS
for a list of all disallowed & filtered flags.Expects: The Generated Record expects a Consumer with a Lambda-Signature like: Signature void accept (double value)
Example:
// Generate a reusable, pre-configured SettingsRec instance final SettingsRec<Double, Void> rec = RJArrPrimConsumerRec.doubleRec(ja, -1.0, 0, null); // You must provide a consumer. rec.setConsumer((double primVal) -> System.out.println(primVal); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec);
-
floatArr
public static SettingsRec<java.lang.Float,java.lang.Void> floatArr (float defaultValue, int FLAGS, ToFloatFunction<java.lang.String> optionalUserParser)
Create a SettingsRec Instance for a Primitive-Float ConsumerGenerates: A Float-Retrieval Settings-Record. Auto-Boxing: Thanks to Java's Auto-Boxing & Un-Boxing the 'float'
Type is Auto-Converted to an'Float'
TypeImportant: Java-Generics cannot assume a Primitive-Types for a Type-Parameter. Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)
Removes: Any JFlag
masks which might insert null-entries in the return-streamSee: Class JFlag
for information about parameter'FLAGS'
See: Flag JFlag.NOT_ALLOWED_RET_NULL_MASKS
for a list of all disallowed & filtered flags.Expects: The Generated Record expects a Consumer with a Lambda-Signature like: Signature void accept (float value)
Example:
// Generate a reusable, pre-configured SettingsRec instance final SettingsRec<Float, Void> rec = RJArrPrimConsumerRec.floatRec(ja, -1.0f, 0, null); // You must provide a consumer. rec.setConsumer((float primVal) -> System.out.println(primVal); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec);
-
booleanArr
public static SettingsRec<java.lang.Boolean,java.lang.Void> booleanArr (boolean defaultValue, int FLAGS, java.util.function.Predicate<java.lang.String> optionalUserParser)
Create a SettingsRec Instance for a Primitive-Boolean ConsumerGenerates: A Boolean-Retrieval Settings-Record. Auto-Boxing: Thanks to Java's Auto-Boxing & Un-Boxing the 'boolean'
Type is Auto-Converted to an'Boolean'
TypeImportant: Java-Generics cannot assume a Primitive-Types for a Type-Parameter. Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.booleanToJava(JsonArray, SettingsRec)
Removes: Any JFlag
masks which might insert null-entries in the return-streamSee: Class JFlag
for information about parameter'FLAGS'
See: Flag JFlag.NOT_ALLOWED_RET_NULL_MASKS
for a list of all disallowed & filtered flags.Expects: The Generated Record expects a Consumer with a Lambda-Signature like: Signature void accept (boolean value)
Example:
// Generate a reusable, pre-configured SettingsRec instance final SettingsRec<Boolean, Void> rec = RJArrPrimConsumerRec.booleanRec(ja, false, 0, null); // You must provide a consumer. rec.setConsumer((boolean primVal) -> System.out.println(primVal); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.booleanToJava(ja, rec);
-
intArr2
public static SettingsRec<java.lang.Integer,java.lang.Void> intArr2 (int defaultValue, int FLAGS, java.util.function.ToIntFunction<java.lang.String> optionalUserParser)
Create a SettingsRec Instance for a Consumer of Primitive-Integers, w/ Array-IndicesGenerates: An Integer-Retrieval Settings-Record. Auto-Boxing: Thanks to Java's Auto-Boxing & Un-Boxing the 'int'
Type is Auto-Converted to an'Integer'
TypeImportant: Java-Generics cannot assume a Primitive-Types for a Type-Parameter. Removes: Any JFlag
masks which might insert null-entries in the return-streamSee: Flag JFlag.NOT_ALLOWED_RET_NULL_MASKS
for a list of all disallowed & filtered flags.Expects: The Generated Record expects a Consumer with a Lambda-Signature like: Signature void accept (int jsonArray, int successCount, int value)
Example:
// Generate a reusable, pre-configured SettingsRec instance final SettingsRec<Integer, Void> rec = RJArrPrimConsumerRec.intRec(ja, -1, 0, null); // You must provide a consumer. rec.setConsumer((int jsonArrayIndex, int successCount, int primVal) -> System.out.println ("JsonArray-Index: " + jsonArrayIndex + ", count: " + successCount + ", value: " + primVal); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec);
-
shortArr2
public static SettingsRec<java.lang.Short,java.lang.Void> shortArr2 (short defaultValue, int FLAGS, ToShortFunction<java.lang.String> optionalUserParser)
Create a SettingsRec Instance for a Consumer of Primitive Short-Integers, w/ Array-IndicesGenerates: A Short-Retrieval Settings-Record. Auto-Boxing: Thanks to Java's Auto-Boxing & Un-Boxing the 'short'
Type is Auto-Converted to an'Short'
TypeImportant: Java-Generics cannot assume a Primitive-Types for a Type-Parameter. Removes: Any JFlag
masks which might insert null-entries in the return-streamSee: Flag JFlag.NOT_ALLOWED_RET_NULL_MASKS
for a list of all disallowed & filtered flags.Expects: The Generated Record expects a Consumer with a Lambda-Signature like: Signature void accept (int jsonArray, int successCount, short value)
Example:
// Generate a reusable, pre-configured SettingsRec instance final SettingsRec<Short, Void> rec = RJArrPrimConsumerRec.shortRec(ja, -1, 0, null); // You must provide a consumer. rec.setConsumer((int jsonArrayIndex, int successCount, short primVal) -> System.out.println ("JsonArray-Index: " + jsonArrayIndex + ", count: " + successCount + ", value: " + primVal); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec);
-
byteArr2
public static SettingsRec<java.lang.Byte,java.lang.Void> byteArr2 (byte defaultValue, int FLAGS, ToByteFunction<java.lang.String> optionalUserParser)
Create a SettingsRec Instance for a Consumer of Primitive-Bytes, w/ Array-IndicesGenerates: A Byte-Retrieval Settings-Record. Auto-Boxing: Thanks to Java's Auto-Boxing & Un-Boxing the 'byte'
Type is Auto-Converted to an'Byte'
TypeImportant: Java-Generics cannot assume a Primitive-Types for a Type-Parameter. Removes: Any JFlag
masks which might insert null-entries in the return-streamSee: Flag JFlag.NOT_ALLOWED_RET_NULL_MASKS
for a list of all disallowed & filtered flags.Expects: The Generated Record expects a Consumer with a Lambda-Signature like: Signature void accept (int jsonArray, int successCount, byte value)
Example:
// Generate a reusable, pre-configured SettingsRec instance final SettingsRec<Byte, Void> rec = RJArrPrimConsumerRec.byteRec(ja, -1, 0, null); // You must provide a consumer. rec.setConsumer((int jsonArrayIndex, int successCount, byte primVal) -> System.out.println ("JsonArray-Index: " + jsonArrayIndex + ", count: " + successCount + ", value: " + primVal); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec);
-
longArr2
public static SettingsRec<java.lang.Long,java.lang.Void> longArr2 (long defaultValue, int FLAGS, java.util.function.ToLongFunction<java.lang.String> optionalUserParser)
Create a SettingsRec Instance for a Consumer of Primitive Long-Integers, w/ Array-IndicesGenerates: A Long-Retrieval Settings-Record. Auto-Boxing: Thanks to Java's Auto-Boxing & Un-Boxing the 'long'
Type is Auto-Converted to an'Long'
TypeImportant: Java-Generics cannot assume a Primitive-Types for a Type-Parameter. Removes: Any JFlag
masks which might insert null-entries in the return-streamSee: Flag JFlag.NOT_ALLOWED_RET_NULL_MASKS
for a list of all disallowed & filtered flags.Expects: The Generated Record expects a Consumer with a Lambda-Signature like: Signature void accept (int jsonArray, int successCount, long value)
Example:
// Generate a reusable, pre-configured SettingsRec instance final SettingsRec<Long, Void> rec = RJArrPrimConsumerRec.longRec(ja, -1, 0, null); // You must provide a consumer. rec.setConsumer((int jsonArrayIndex, int successCount, long primVal) -> System.out.println ("JsonArray-Index: " + jsonArrayIndex + ", count: " + successCount + ", value: " + primVal); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec);
-
doubleArr2
public static SettingsRec<java.lang.Double,java.lang.Void> doubleArr2 (double defaultValue, int FLAGS, java.util.function.ToDoubleFunction<java.lang.String> optionalUserParser)
Create a SettingsRec Instance for a Consumer of Primitive-Doubles, w/ Array-IndicesGenerates: A Double-Retrieval Settings-Record. Auto-Boxing: Thanks to Java's Auto-Boxing & Un-Boxing the 'double'
Type is Auto-Converted to an'Double'
TypeImportant: Java-Generics cannot assume a Primitive-Types for a Type-Parameter. Removes: Any JFlag
masks which might insert null-entries in the return-streamSee: Flag JFlag.NOT_ALLOWED_RET_NULL_MASKS
for a list of all disallowed & filtered flags.Expects: The Generated Record expects a Consumer with a Lambda-Signature like: Signature void accept (int jsonArray, int successCount, double value)
Example:
// Generate a reusable, pre-configured SettingsRec instance final SettingsRec<Double, Void> rec = RJArrPrimConsumerRec.doubleRec(ja, -1.0, 0, null); // You must provide a consumer. rec.setConsumer((int jsonArrayIndex, int successCount, double primVal) -> System.out.println ("JsonArray-Index: " + jsonArrayIndex + ", count: " + successCount + ", value: " + primVal); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec);
-
floatArr2
public static SettingsRec<java.lang.Float,java.lang.Void> floatArr2 (float defaultValue, int FLAGS, ToFloatFunction<java.lang.String> optionalUserParser)
Create a SettingsRec Instance for a Consumer of Primitive-Floats, w/ Array-IndicesGenerates: A Float-Retrieval Settings-Record. Auto-Boxing: Thanks to Java's Auto-Boxing & Un-Boxing the 'float'
Type is Auto-Converted to an'Float'
TypeImportant: Java-Generics cannot assume a Primitive-Types for a Type-Parameter. Removes: Any JFlag
masks which might insert null-entries in the return-streamSee: Flag JFlag.NOT_ALLOWED_RET_NULL_MASKS
for a list of all disallowed & filtered flags.Expects: The Generated Record expects a Consumer with a Lambda-Signature like: Signature void accept (int jsonArray, int successCount, float value)
Example:
// Generate a reusable, pre-configured SettingsRec instance final SettingsRec<Float, Void> rec = RJArrPrimConsumerRec.floatRec(ja, -1.0f, 0, null); // You must provide a consumer. rec.setConsumer((int jsonArrayIndex, int successCount, float primVal) -> System.out.println ("JsonArray-Index: " + jsonArrayIndex + ", count: " + successCount + ", value: " + primVal); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec);
-
booleanArr2
public static SettingsRec<java.lang.Boolean,java.lang.Void> booleanArr2 (boolean defaultValue, int FLAGS, java.util.function.Predicate<java.lang.String> optionalUserParser)
Create a SettingsRec Instance for a Consumer of Primitive-Booleans, w/ Array-IndicesGenerates: A Boolean-Retrieval Settings-Record. Auto-Boxing: Thanks to Java's Auto-Boxing & Un-Boxing the 'boolean'
Type is Auto-Converted to an'Boolean'
TypeImportant: Java-Generics cannot assume a Primitive-Types for a Type-Parameter. Removes: Any JFlag
masks which might insert null-entries in the return-streamSee: Flag JFlag.NOT_ALLOWED_RET_NULL_MASKS
for a list of all disallowed & filtered flags.Expects: The Generated Record expects a Consumer with a Lambda-Signature like: Signature void accept (int jsonArray, int successCount, boolean value)
Example:
// Generate a reusable, pre-configured SettingsRec instance final SettingsRec<Boolean, Void> rec = RJArrPrimConsumerRec.booleanRec(ja, false, 0, null); // You must provide a consumer. rec.setConsumer((int jsonArrayIndex, int successCount, boolean primVal) -> System.out.println ("JsonArray-Index: " + jsonArrayIndex + ", count: " + successCount + ", value: " + primVal); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.booleanToJava(ja, rec);
-
-