Package Torello.JSON
Class RJArrBoxedConsumerRec
- java.lang.Object
-
- Torello.JSON.RJArrBoxedConsumerRec
-
public class RJArrBoxedConsumerRec extends java.lang.Object
RJArrBoxedConsumerRec 🠞RJArr- ReadJsonArray
This class is a helper class, used for reading data directly from an already parsedJsonArrayinstance.
BoxedConsumer- Data is sent to a Java-Consumer of a Boxed-Primitive Type.
Rec- The methods in this class produce a pre-configuredSettingsRecinstance. Re-using a Configuration-Record can speed up processing when more than oneJsonArrayneeds to be handled. This record should be used in conjunction with the classProcessJsonArrayto process multipleJsonArray's, efficiently.
Generate a Pre-ConfiguredSettingsRecinstance which can handle Java Boxed-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 Glass Fish Tool is included in the J2EE, and is available on GitHub. That is the one used by the Java HTML JAR Library (See:javax.json.*)
Primary Classes Used:JsonArrayandJsonObject
This comment-note is intentionally repeated, verbatim, at the top of all Json Reader Classes in this package.
JSON to Java Binding:
JSON-Binding is the art of converting data that has been stored, saved or transmitted usingJava-Script Object Notationinto a Java Primitive or Object-Type.JSONcan arrive into Java-Program Memory from almost any source. If you are wondering why such a massive amount of "work" is necessary just to convert a Json Integer into Java Integer, the value added is the extraordinary amount of attention paid to user configuration, error checking, & exception messaging. Methods here don't require more than 1 or 2 lines of code, and guarantee that a thorough type checking is performed.
Unlike Java-Types which are checked by the Java-Compiler each-and-every time a programmer compiles his project, any guarantee that JSON-Type Data is pristine, uncorrupted, and in any kind of pre-agreed format may or may not be assured. The methods here are able to handle changes that might be made to an API (possibly from great distances away, and without the Software-Manager's consent). If an error could occur, configuration flags can be used to determine default error-recovery behaviors. If an exception does throw, the exception messages printed will contain multiple lines of detailed information.- Utilizes the Java-Standard
javax.json.*Package-Library, & its Glass-Fish Implementation - Handles the Transfer & Conversion of All Json-Type's into Java-Type's with just One Line of Code
- Provides all manner of User-Configurable Exception-Handling &
Error-Decision Management via Class
JFlag - Provides a Fine-Grained Suite of Exception-Classes, all with Consistent & Meaningful Error-Messages. Json Files can occasionally grow extremely large, and error messaging details make debugging easier
- Primary Helper-Classes for the (Experimental) Google-Chrome
Browser AutomationPackage
The goal ofTorello.JSONis to provide small, static helper methods in the same spirit asjava.util.Objectsandjava.util.Arrays: simple calls that keep JSON handling out of your application logic. Instead of repeating loops, type checks, null checks, and exception wiring at every call site, these methods centralize that work behind a consistent set of straight-forward “read value” operations.
Generate a Settings-Record for reading JsonArray's which Sends Boxed-Values to a Consumer
This class generates the Pre-Packaged, Pre-ConfiguredSettingsRecinstances that may be used to optimize loops. Use the records that are produced by the methods in this class in conjunction with the classProcessJsonArrayto (more efficiently) process MultipleJsonArray'swith similar characteristics.
Optimize Loops:
Methods in this class whose name ends with the letters'Rec'are methods that 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.
In order to guarantee that there is a homogenous algorithm for processing these array indices, only a few 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 aJsonArraywhich 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 multiple short-lived, ephemeral, object instances (which are immediately discarded and collected by the Garbage-Collector) can be avoided.
To do this is quite simple. Please review the documentation for any and all methods in this JSON Package whose name ends with'Rec'- and look at the example code provided for how to use them. Most of those methods do include an example. Using a Loop Optimized method is a very simple, two step procedure as explained here:- First, generate an instance of the
SettingsRecclass. 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> defaultValueWhen 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_IOBandRD_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 FLAGSA 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.Function
<String, BOXED_TYPE>
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_STRandRP_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:This File's Source Code:
- View Here: Torello/JSON/RJArrBoxedConsumerRec.java
- Open New Browser-Tab: Torello/JSON/RJArrBoxedConsumerRec.java
File Size: 16,318 Bytes Line Count: 405 '\n' Characters Found
Internal Use Only: Settings-Record Helper:
- View Here: BASIC_TYPES.java
- Open New Browser-Tab: BASIC_TYPES.java
File Size: 28,899 Bytes Line Count: 621 '\n' Characters Found
Internal Use Only: Settings-Record Helper:
- View Here: SETTINGS_REC_BUILDER.java
- Open New Browser-Tab: SETTINGS_REC_BUILDER.java
File Size: 9,477 Bytes Line Count: 218 '\n' Characters Found
Internal Use Only: Settings-Record Helper:
- View Here: CHANGEABLE_CONSUMER.java
- Open New Browser-Tab: CHANGEABLE_CONSUMER.java
File Size: 2,898 Bytes Line Count: 78 '\n' Characters Found
Stateless Class:This class neither contains any program-state, nor can it be instantiated. The@StaticFunctionalAnnotation may also be called 'The Spaghetti Report'.Static-Functionalclasses are, essentially, C-Styled Files, without any constructors or non-static member fields. It is a concept very similar to the Java-Bean's@StatelessAnnotation.
- 1 Constructor(s), 1 declared private, zero-argument constructor
- 16 Method(s), 16 declared static
- 0 Field(s)
-
-
Method Summary
Generate a SettingsRec Instance which reads aJsonArrayinto a Java Boxed-Primitives ConsumerModifier and Type Method static SettingsRec<Boolean,Void>booleanRec(boolean defaultValue, int FLAGS, Function<String,Boolean> optionalUserParser)static SettingsRec<Byte,Void>byteRec(byte defaultValue, int FLAGS, Function<String,Byte> optionalUserParser)static SettingsRec<Double,Void>doubleRec(double defaultValue, int FLAGS, Function<String,Double> optionalUserParser)static SettingsRec<Float,Void>floatRec(float defaultValue, int FLAGS, Function<String,Float> optionalUserParser)static SettingsRec<Integer,Void>intRec(int defaultValue, int FLAGS, Function<String,Integer> optionalUserParser)static SettingsRec<Long,Void>longRec(long defaultValue, int FLAGS, Function<String,Long> optionalUserParser)static SettingsRec<Number,Void>numberRec(Number defaultValue, int FLAGS, Function<String,Number> optionalUserParser)static SettingsRec<Short,Void>shortRec(short defaultValue, int FLAGS, Function<String,Short> optionalUserParser)Generate a SettingsRec Instance which reads aJsonArrayinto a Boxed-Primitives Consumer, w/ Array-IndicesModifier and Type Method static SettingsRec<Boolean,Void>booleanRec2(boolean defaultValue, int FLAGS, Function<String,Boolean> optionalUserParser)static SettingsRec<Byte,Void>byteRec2(byte defaultValue, int FLAGS, Function<String,Byte> optionalUserParser)static SettingsRec<Double,Void>doubleRec2(double defaultValue, int FLAGS, Function<String,Double> optionalUserParser)static SettingsRec<Float,Void>floatRec2(float defaultValue, int FLAGS, Function<String,Float> optionalUserParser)static SettingsRec<Integer,Void>intRec2(int defaultValue, int FLAGS, Function<String,Integer> optionalUserParser)static SettingsRec<Long,Void>longRec2(long defaultValue, int FLAGS, Function<String,Long> optionalUserParser)static SettingsRec<Number,Void>numberRec2(Number defaultValue, int FLAGS, Function<String,Number> optionalUserParser)static SettingsRec<Short,Void>shortRec2(short defaultValue, int FLAGS, Function<String,Short> optionalUserParser)
-
-
-
Method Detail
-
intRec
public static SettingsRec<java.lang.Integer,java.lang.Void> intRec (int defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Integer> optionalUserParser)
Create a SettingsRec Instance for a Boxed-Integer ConsumerGenerates: An Integer-Retrieval Settings-Record. Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)See: Class JFlagfor information about the'FLAGS'parameter.Value: Generating the internally used SettingsRecObject-Instance yourself makes code more efficient. In this way, the object is constructed only once, rather than each time a new array is to be processed.
Example:
// Generate a new & re-useable SettingsRec (Make less work for the G.C.) final SettingsRec<Integer, Void> rec = RJArrBoxedConsumerRec.intRec(0, 0, null); for (JsonArray ja : someJsonArraySource) { // Create a new Consumer, make sure to use the Double-Colon '::' Syntax Here final List<Integer> list = new List<>(); rec.setConsumer(list::add); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec); // The list has been properly populated, so now use the results doSomethingWith(list); }
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Integer, Void> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_INTEGER()) .updateableConsumer(true);
-
shortRec
public static SettingsRec<java.lang.Short,java.lang.Void> shortRec (short defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Short> optionalUserParser)
Create a SettingsRec Instance for a Boxed Short-Integer ConsumerGenerates: A Short-Retrieval Settings-Record. Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)See: Class JFlagfor information about the'FLAGS'parameter.Value: Generating the internally used SettingsRecObject-Instance yourself makes code more efficient. In this way, the object is constructed only once, rather than each time a new array is to be processed.
Example:
// Generate a new & re-useable SettingsRec (Make less work for the G.C.) final SettingsRec<Short, Void> rec = RJArrBoxedConsumerRec.shortRec(0, 0, null); for (JsonArray ja : someJsonArraySource) { // Create a new Consumer, make sure to use the Double-Colon '::' Syntax Here final List<Short> list = new List<>(); rec.setConsumer(list::add); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec); // The list has been properly populated, so now use the results doSomethingWith(list); }
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Short, Void> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_SHORT()) .updateableConsumer(true);
-
byteRec
public static SettingsRec<java.lang.Byte,java.lang.Void> byteRec (byte defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Byte> optionalUserParser)
Create a SettingsRec Instance for a Boxed-Byte ConsumerGenerates: A Byte-Retrieval Settings-Record. Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)See: Class JFlagfor information about the'FLAGS'parameter.Value: Generating the internally used SettingsRecObject-Instance yourself makes code more efficient. In this way, the object is constructed only once, rather than each time a new array is to be processed.
Example:
// Generate a new & re-useable SettingsRec (Make less work for the G.C.) final SettingsRec<Byte, Void> rec = RJArrBoxedConsumerRec.byteRec(0, 0, null); for (JsonArray ja : someJsonArraySource) { // Create a new Consumer, make sure to use the Double-Colon '::' Syntax Here final List<Byte> list = new List<>(); rec.setConsumer(list::add); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec); // The list has been properly populated, so now use the results doSomethingWith(list); }
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Byte, Void> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_BYTE()) .updateableConsumer(true);
-
longRec
public static SettingsRec<java.lang.Long,java.lang.Void> longRec (long defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Long> optionalUserParser)
Create a SettingsRec Instance for a Boxed Long-Integer ConsumerGenerates: A Long-Retrieval Settings-Record. Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)See: Class JFlagfor information about the'FLAGS'parameter.Value: Generating the internally used SettingsRecObject-Instance yourself makes code more efficient. In this way, the object is constructed only once, rather than each time a new array is to be processed.
Example:
// Generate a new & re-useable SettingsRec (Make less work for the G.C.) final SettingsRec<Long, Void> rec = RJArrBoxedConsumerRec.longRec(0, 0, null); for (JsonArray ja : someJsonArraySource) { // Create a new Consumer, make sure to use the Double-Colon '::' Syntax Here final List<Long> list = new List<>(); rec.setConsumer(list::add); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec); // The list has been properly populated, so now use the results doSomethingWith(list); }
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Long, Void> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_LONG()) .updateableConsumer(true);
-
doubleRec
public static SettingsRec<java.lang.Double,java.lang.Void> doubleRec (double defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Double> optionalUserParser)
Create a SettingsRec Instance for a Boxed-Double ConsumerGenerates: A Double-Retrieval Settings-Record. Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)See: Class JFlagfor information about the'FLAGS'parameter.Value: Generating the internally used SettingsRecObject-Instance yourself makes code more efficient. In this way, the object is constructed only once, rather than each time a new array is to be processed.
Example:
// Generate a new & re-useable SettingsRec (Make less work for the G.C.) final SettingsRec<Double, Void> rec = RJArrBoxedConsumerRec.doubleRec(0.0, 0, null); for (JsonArray ja : someJsonArraySource) { // Create a new Consumer, make sure to use the Double-Colon '::' Syntax Here final List<Double> list = new List<>(); rec.setConsumer(list::add); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec); // The list has been properly populated, so now use the results doSomethingWith(list); }
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Double, Void> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_DOUBLE()) .updateableConsumer(true);
-
floatRec
public static SettingsRec<java.lang.Float,java.lang.Void> floatRec (float defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Float> optionalUserParser)
Create a SettingsRec Instance for a Boxed-Float ConsumerGenerates: A Float-Retrieval Settings-Record. Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)See: Class JFlagfor information about the'FLAGS'parameter.Value: Generating the internally used SettingsRecObject-Instance yourself makes code more efficient. In this way, the object is constructed only once, rather than each time a new array is to be processed.
Example:
// Generate a new & re-useable SettingsRec (Make less work for the G.C.) final SettingsRec<Float, Void> rec = RJArrBoxedConsumerRec.floatRec(0.0f, 0, null); for (JsonArray ja : someJsonArraySource) { // Create a new Consumer, make sure to use the Double-Colon '::' Syntax Here final List<Float> list = new List<>(); rec.setConsumer(list::add); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec); // The list has been properly populated, so now use the results doSomethingWith(list); }
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Float, Void> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_FLOAT()) .updateableConsumer(true);
-
booleanRec
public static SettingsRec<java.lang.Boolean,java.lang.Void> booleanRec (boolean defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Boolean> optionalUserParser)
Create a SettingsRec Instance for a Boxed-Boolean ConsumerGenerates: A Boolean-Retrieval Settings-Record. Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.booleanToJava(JsonArray, SettingsRec)See: Class JFlagfor information about the'FLAGS'parameter.Value: Generating the internally used SettingsRecObject-Instance yourself makes code more efficient. In this way, the object is constructed only once, rather than each time a new array is to be processed.
Example:
// Generate a new & re-useable SettingsRec (Make less work for the G.C.) final SettingsRec<Boolean, Void> rec = RJArrBoxedConsumerRec.booleanRec(false, 0, null); for (JsonArray ja : someJsonArraySource) { // Create a new Consumer, make sure to use the Double-Colon '::' Syntax Here final List<Boolean> list = new List<>(); rec.setConsumer(list::add); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.booleanToJava(ja, rec); // The list has been properly populated, so now use the results doSomethingWith(list); }
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Boolean, Void> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_BOOLEAN()) .updateableConsumer(true);
-
numberRec
public static SettingsRec<java.lang.Number,java.lang.Void> numberRec (java.lang.Number defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Number> optionalUserParser)
Create a SettingsRec Instance for a (Best Filt) Boxed-Number ConsumerGenerates: A Number-Retrieval Settings-Record. Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)See: Class JFlagfor information about the'FLAGS'parameter.Value: Generating the internally used SettingsRecObject-Instance yourself makes code more efficient. In this way, the object is constructed only once, rather than each time a new array is to be processed.
Example:
// Generate a new & re-useable SettingsRec (Make less work for the G.C.) final SettingsRec<Number, Void> rec = RJArrBoxedConsumerRec.intRec(0, 0, null); for (JsonArray ja : someJsonArraySource) { // Create a new Consumer, make sure to use the Double-Colon '::' Syntax Here final List<Number> list = new List<>(); rec.setConsumer(list::add); // Process the Json-Array, and send the results to the consumer ProcessJsonArray.numericToJava(ja, rec); // The list has been properly populated, so now use the results doSomethingWith(list); }
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Number, Void> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.NUMBER_REC()) .updateableConsumer(true);
-
intRec2
public static SettingsRec<java.lang.Integer,java.lang.Void> intRec2 (int defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Integer> optionalUserParser)
Create a SettingsRec Instance for a Consumer of Boxed-Integers, w/ Array-IndicesGenerates: An Integer-Retrieval Settings-Record, w/ an "Array-Indices & Count Consumer" Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)See: Class JFlagfor information about the'FLAGS'parameter.
Example:
// Generate a new & re-useable SettingsRec (Make less work for the G.C.) final SettingsRec<Integer, Void> rec = RJArrBoxedConsumerRec.intRec2(1, 0, null); // Create a Simple "Print the Values & Counts" Consumer. final IntIntTConsumer<Integer> c = (int jsonArrayIndex, int acceptCount, Integer value) -> System.out.println ("arrPos: " + jsonArrayIndex + ", count: " + acceptCount + ", value: " + value) // You must provide a consumer. The Double-Colon '::' Syntax is not required here. rec.setConsumer(c); // Re-Uses the Same SettingsRec instance. Also reuses the exact same Printing-Consumer for (JsonArray ja : someJsonArraySource) ProcessJsonArray.numericToJava(ja, rec);
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Integer, Void> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_INTEGER()) .updateableConsumer(false);
-
shortRec2
public static SettingsRec<java.lang.Short,java.lang.Void> shortRec2 (short defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Short> optionalUserParser)
Create a SettingsRec Instance for a Consumer of Boxed Short-Integers, w/ Array-IndicesGenerates: A Short-Retrieval Settings-Record, w/ an "Array-Indices & Count Consumer" Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)See: Class JFlagfor information about the'FLAGS'parameter.
Example:
// Generate a new & re-useable SettingsRec (Make less work for the G.C.) final SettingsRec<Short, Void> rec = RJArrBoxedConsumerRec.shortRec2(1, 0, null); // Create a Simple "Print the Values & Counts" Consumer. final IntIntTConsumer<Short> c = (int jsonArrayIndex, int acceptCount, Short value) -> System.out.println ("arrPos: " + jsonArrayIndex + ", count: " + acceptCount + ", value: " + value) // You must provide a consumer. The Double-Colon '::' Syntax is not required here. rec.setConsumer(c); // Re-Uses the Same SettingsRec instance. Also reuses the exact same Printing-Consumer for (JsonArray ja : someJsonArraySource) ProcessJsonArray.numericToJava(ja, rec);
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Short, Void> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_SHORT()) .updateableConsumer(false);
-
byteRec2
public static SettingsRec<java.lang.Byte,java.lang.Void> byteRec2 (byte defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Byte> optionalUserParser)
Create a SettingsRec Instance for a Consumer of Boxed-Bytes, w/ Array-IndicesGenerates: A Byte-Retrieval Settings-Record, w/ an "Array-Indices & Count Consumer" Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)See: Class JFlagfor information about the'FLAGS'parameter.
Example:
// Generate a new & re-useable SettingsRec (Make less work for the G.C.) final SettingsRec<Byte, Void> rec = RJArrBoxedConsumerRec.byteRec2(1, 0, null); // Create a Simple "Print the Values & Counts" Consumer. final IntIntTConsumer<Byte> c = (int jsonArrayIndex, int acceptCount, Byte value) -> System.out.println ("arrPos: " + jsonArrayIndex + ", count: " + acceptCount + ", value: " + value) // You must provide a consumer. The Double-Colon '::' Syntax is not required here. rec.setConsumer(c); // Re-Uses the Same SettingsRec instance. Also reuses the exact same Printing-Consumer for (JsonArray ja : someJsonArraySource) ProcessJsonArray.numericToJava(ja, rec);
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Byte, Void> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_BYTE()) .updateableConsumer(false);
-
longRec2
public static SettingsRec<java.lang.Long,java.lang.Void> longRec2 (long defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Long> optionalUserParser)
Create a SettingsRec Instance for a Consumer of Boxed Long-Integers, w/ Array-IndicesGenerates: A Long-Retrieval Settings-Record, w/ an "Array-Indices & Count Consumer" Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)See: Class JFlagfor information about the'FLAGS'parameter.
Example:
// Generate a new & re-useable SettingsRec (Make less work for the G.C.) final SettingsRec<Long, Void> rec = RJArrBoxedConsumerRec.longRec2(1, 0, null); // Create a Simple "Print the Values & Counts" Consumer. final IntIntTConsumer<Long> c = (int jsonArrayIndex, int acceptCount, Long value) -> System.out.println ("arrPos: " + jsonArrayIndex + ", count: " + acceptCount + ", value: " + value) // You must provide a consumer. The Double-Colon '::' Syntax is not required here. rec.setConsumer(c); // Re-Uses the Same SettingsRec instance. Also reuses the exact same Printing-Consumer for (JsonArray ja : someJsonArraySource) ProcessJsonArray.numericToJava(ja, rec);
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Long, Void> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_LONG()) .updateableConsumer(false);
-
doubleRec2
public static SettingsRec<java.lang.Double,java.lang.Void> doubleRec2 (double defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Double> optionalUserParser)
Create a SettingsRec Instance for a Consumer of Boxed-Doubles, w/ Array-IndicesGenerates: A Double-Retrieval Settings-Record, w/ an "Array-Indices & Count Consumer" Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)See: Class JFlagfor information about the'FLAGS'parameter.
Example:
// Generate a new & re-useable SettingsRec (Make less work for the G.C.) final SettingsRec<Double, Void> rec = RJArrBoxedConsumerRec.doubleRec2(1.0, 0, null); // Create a Simple "Print the Values & Counts" Consumer. final IntIntTConsumer<Double> c = (int jsonArrayIndex, int acceptCount, Double value) -> System.out.println ("arrPos: " + jsonArrayIndex + ", count: " + acceptCount + ", value: " + value) // You must provide a consumer. The Double-Colon '::' Syntax is not required here. rec.setConsumer(c); // Re-Uses the Same SettingsRec instance. Also reuses the exact same Printing-Consumer for (JsonArray ja : someJsonArraySource) ProcessJsonArray.numericToJava(ja, rec);
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Double, Void> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_DOUBLE()) .updateableConsumer(false);
-
floatRec2
public static SettingsRec<java.lang.Float,java.lang.Void> floatRec2 (float defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Float> optionalUserParser)
Create a SettingsRec Instance for a Consumer of Boxed-Floats, w/ Array-IndicesGenerates: A Float-Retrieval Settings-Record, w/ an "Array-Indices & Count Consumer" Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)See: Class JFlagfor information about the'FLAGS'parameter.
Example:
// Generate a new & re-useable SettingsRec (Make less work for the G.C.) final SettingsRec<Float, Void> rec = RJArrBoxedConsumerRec.floatRec2(1.0f, 0, null); // Create a Simple "Print the Values & Counts" Consumer. final IntIntTConsumer<Float> c = (int jsonArrayIndex, int acceptCount, Float value) -> System.out.println ("arrPos: " + jsonArrayIndex + ", count: " + acceptCount + ", value: " + value) // You must provide a consumer. The Double-Colon '::' Syntax is not required here. rec.setConsumer(c); // Re-Uses the Same SettingsRec instance. Also reuses the exact same Printing-Consumer for (JsonArray ja : someJsonArraySource) ProcessJsonArray.numericToJava(ja, rec);
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Float, Void> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_FLOAT()) .updateableConsumer(false);
-
booleanRec2
public static SettingsRec<java.lang.Boolean,java.lang.Void> booleanRec2 (boolean defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Boolean> optionalUserParser)
Create a SettingsRec Instance for a Consumer of Boxed-Booleans, w/ Array-IndicesGenerates: A Boolean-Retrieval Settings-Record, w/ an "Array-Indices & Count Consumer" Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.booleanToJava(JsonArray, SettingsRec)See: Class JFlagfor information about the'FLAGS'parameter.
Example:
// Generate a new & re-useable SettingsRec (Make less work for the G.C.) final SettingsRec<Boolean, Void> rec = RJArrBoxedConsumerRec.booleanRec2(false, 0, null); // Create a Simple "Print the Values & Counts" Consumer. final IntIntTConsumer<Boolean> c = (int jsonArrayIndex, int acceptCount, Boolean value) -> System.out.println ("arrPos: " + jsonArrayIndex + ", count: " + acceptCount + ", value: " + value) // You must provide a consumer. The Double-Colon '::' Syntax is not required here. rec.setConsumer(c); // Re-Uses the Same SettingsRec instance. Also reuses the exact same Printing-Consumer for (JsonArray ja : someJsonArraySource) ProcessJsonArray.booleanToJava(ja, rec);
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Boolean, Void> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_BOOLEAN()) .updateableConsumer(false);
-
numberRec2
public static SettingsRec<java.lang.Number,java.lang.Void> numberRec2 (java.lang.Number defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Number> optionalUserParser)
Create a SettingsRec Instance for a Consumer of (Best-Fit) Boxed-Numbers, w/ Array-IndicesGenerates: A Number-Retrieval Settings-Record, w/ an "Array-Indices & Count Consumer" Used For: The record produced from this method may be used as a parameter to invoke: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)See: Class JFlagfor information about the'FLAGS'parameter.
Example:
// Generate a new & re-useable SettingsRec (Make less work for the G.C.) final SettingsRec<Number, Void> rec = RJArrBoxedConsumerRec.numberRec2(1, 0, null); // Create a Simple "Print the Values & Counts" Consumer. final IntIntTConsumer<Number> c = (int jsonArrayIndex, int acceptCount, Number value) -> System.out.println ("arrPos: " + jsonArrayIndex + ", count: " + acceptCount + ", value: " + value) // You must provide a consumer. The Double-Colon '::' Syntax is not required here. rec.setConsumer(c); // Re-Uses the Same SettingsRec instance. Also reuses the exact same Printing-Consumer for (JsonArray ja : someJsonArraySource) ProcessJsonArray.numericToJava(ja, rec);
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Number, Void> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.NUMBER_REC()) .updateableConsumer(false);
-
-