Package Torello.JSON
Class RJArrIntoBoxedStream
- java.lang.Object
-
- Torello.JSON.RJArrIntoBoxedStream
-
public class RJArrIntoBoxedStream extends java.lang.Object
RJArrIntoBoxedStream 🠞RJArr- ReadJsonArray
This class is used for reading data directly from an already parsedJsonArrayinstance.
Into- Data that is extracted, is sent to a specific User-Provided Destination.
BoxedStream- Data is sent to a Java-Stream of a Boxed-Primitive Type.
Utilities for parsing Json Array's and sending the parsed values into a Java Strea of 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.
Extract Elements from a JsonArray, and convert them to a Java Stream of Boxed Primitives
Each of the methods in this class, all of which are declared'static', accept a standardJsonArrayas input, and make a (User-Specified) "Best Efforts" attempt to convert each of these elements into a Boxed-Primitive Type. Once transformed, the computed & extracted values are then sent to a Java-Stream whose Generic-Type is comprised of the relevant Boxed-Type.
Just to serve as a reminder, a Java 'Boxed Primitive' structure is nearly identical to a regular primitive value, save for the following differences:Boxed Primitive'sare wrapped in an (artificial) Object-Reference, and may be passed-by-reference, no different than any othe Java Object-Reference. (In reality they are variant of 'Value-Classes', and their wrappers do not actually exists)- Boxed-Types may be assigned null, and will not force
NullPointerExceptionto throw when they are assigned null - nor produce any other adverse or unintended issues.. - Boxed-Types have several Class-Member functions to which their values may be applied
Each Json-Array Element that is successfully converted into a Boxed-Value (or null) is subsequently used as input with a Java-Stream'Stream.Builder<T>.accept(T t)'method. Note that the Generic-Type'T'will be identical to (or a parent of) the Json-Array Method-Type that was selected (when this method was actually invoked).
This class is capable of processing 7 of the 8 Java Boxed-Types that are available. The standard type'java.lang.Character'is not accomodated by any of the Json Array-Processing Classes in this Json-Package. For each method in this class, the user is expected to provide a singleJsonArray.
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 jaThis may be any parsed JsonArraywhose contents are consistent with the Expected Output-Stram Base-Type returned from whichever method is being invoked.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 FlagsFLAGSA 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-Classes.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/RJArrIntoBoxedStream.java
- Open New Browser-Tab: Torello/JSON/RJArrIntoBoxedStream.java
File Size: 15,624 Bytes Line Count: 377 '\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
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
Read the Contents of a Json-Array into a Java-Stream of Boxed-Primitives Modifier and Type Method static Stream<Boolean>booleanArr(JsonArray ja, boolean defaultValue, int FLAGS, Function<String,Boolean> optionalUserParser)static Stream<Byte>byteArr(JsonArray ja, byte defaultValue, int FLAGS, Function<String,Byte> optionalUserParser)static Stream<Double>doubleArr(JsonArray ja, double defaultValue, int FLAGS, Function<String,Double> optionalUserParser)static Stream<Float>floatArr(JsonArray ja, float defaultValue, int FLAGS, Function<String,Float> optionalUserParser)static Stream<Integer>intArr(JsonArray ja, int defaultValue, int FLAGS, Function<String,Integer> optionalUserParser)static Stream<Long>longArr(JsonArray ja, long defaultValue, int FLAGS, Function<String,Long> optionalUserParser)static Stream<Number>numberArr(JsonArray ja, Number defaultValue, int FLAGS, Function<String,Number> optionalUserParser)static Stream<Short>shortArr(JsonArray ja, short defaultValue, int FLAGS, Function<String,Short> optionalUserParser)Loop Optimization: Generate a Reusable SettingsRec Instance Modifier and Type Method static SettingsRec<Boolean,
Stream<Boolean>>booleanRec(boolean defaultValue, int FLAGS, Function<String,Boolean> optionalUserParser)static SettingsRec<Byte,
Stream<Byte>>byteRec(byte defaultValue, int FLAGS, Function<String,Byte> optionalUserParser)static SettingsRec<Double,
Stream<Double>>doubleRec(double defaultValue, int FLAGS, Function<String,Double> optionalUserParser)static SettingsRec<Float,
Stream<Float>>floatRec(float defaultValue, int FLAGS, Function<String,Float> optionalUserParser)static SettingsRec<Integer,
Stream<Integer>>intRec(int defaultValue, int FLAGS, Function<String,Integer> optionalUserParser)static SettingsRec<Long,
Stream<Long>>longRec(long defaultValue, int FLAGS, Function<String,Long> optionalUserParser)static SettingsRec<Number,
Stream<Number>>numberRec(Number defaultValue, int FLAGS, Function<String,Number> optionalUserParser)static SettingsRec<Short,
Stream<Short>>shortRec(short defaultValue, int FLAGS, Function<String,Short> optionalUserParser)
-
-
-
Method Detail
-
intArr
public static java.util.stream.Stream<java.lang.Integer> intArr (JsonArray ja, int defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Integer> optionalUserParser)
Generate a Java Stream of Boxed-IntegersInvokes: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)Passes: An Integer-Retrieval Settings-Record. See: Class JFlagfor information about the'FLAGS'parameter.Producing a Boxed-Integer Array from this Method is as Follows:
Java Line of Code:
Integer[] arr = RJArrIntoBoxedStream .intArr(ja, 0, 0, null) .toArray(Integer[]::new);
- See Also:
ProcessJsonArray.numericToJava(JsonArray, SettingsRec),intRec(int, int, Function)- Code:
- Exact Method Body:
return ProcessJsonArray.numericToJava (ja, intRec(defaultValue, FLAGS, optionalUserParser));
-
shortArr
public static java.util.stream.Stream<java.lang.Short> shortArr (JsonArray ja, short defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Short> optionalUserParser)
Generate a Java Stream of Boxed Short-IntegersInvokes: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)Passes: A Short-Retrieval Settings-Record. See: Class JFlagfor information about the'FLAGS'parameter.Producing a Boxed-Short Array from this Method is as Follows:
Java Line of Code:
Short[] arr = RJArrIntoBoxedStream .shortArr(ja, 0, 0, null) .toArray(Short[]::new);
- See Also:
ProcessJsonArray.numericToJava(JsonArray, SettingsRec),shortRec(short, int, Function)- Code:
- Exact Method Body:
return ProcessJsonArray.numericToJava (ja, shortRec(defaultValue, FLAGS, optionalUserParser));
-
byteArr
public static java.util.stream.Stream<java.lang.Byte> byteArr (JsonArray ja, byte defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Byte> optionalUserParser)
Generate a Java Stream of Boxed-BytesInvokes: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)Passes: A Byte-Retrieval Settings-Record. See: Class JFlagfor information about the'FLAGS'parameter.Producing a Boxed-Byte Array from this Method is as Follows:
Java Line of Code:
Byte[] arr = RJArrIntoBoxedStream .byteArr(ja, 0, 0, null) .toArray(Byte[]::new);
- See Also:
ProcessJsonArray.numericToJava(JsonArray, SettingsRec),byteRec(byte, int, Function)- Code:
- Exact Method Body:
return ProcessJsonArray.numericToJava (ja, byteRec(defaultValue, FLAGS, optionalUserParser));
-
longArr
public static java.util.stream.Stream<java.lang.Long> longArr (JsonArray ja, long defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Long> optionalUserParser)
Generate a Java Stream of Boxed Long-IntegersInvokes: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)Passes: A Long-Retrieval Settings-Record. See: Class JFlagfor information about the'FLAGS'parameter.Producing a Boxed-Long Array from this Method is as Follows:
Java Line of Code:
Long[] arr = RJArrIntoBoxedStream .longArr(ja, 0, 0, null) .toArray(Long[]::new);
- See Also:
ProcessJsonArray.numericToJava(JsonArray, SettingsRec),longRec(long, int, Function)- Code:
- Exact Method Body:
return ProcessJsonArray.numericToJava (ja, longRec(defaultValue, FLAGS, optionalUserParser));
-
doubleArr
public static java.util.stream.Stream<java.lang.Double> doubleArr (JsonArray ja, double defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Double> optionalUserParser)
Generate a Java Stream of Boxed-DoublesInvokes: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)Passes: A Double-Retrieval Settings-Record. See: Class JFlagfor information about the'FLAGS'parameter.Producing a Boxed-Double Array from this Method is as Follows:
Java Line of Code:
Double[] arr = RJArrIntoBoxedStream .doubleArr(ja, 0, 0, null) .toArray(Double[]::new);
- See Also:
ProcessJsonArray.numericToJava(JsonArray, SettingsRec),doubleRec(double, int, Function)- Code:
- Exact Method Body:
return ProcessJsonArray.numericToJava (ja, doubleRec(defaultValue, FLAGS, optionalUserParser));
-
floatArr
public static java.util.stream.Stream<java.lang.Float> floatArr (JsonArray ja, float defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Float> optionalUserParser)
Generate a Java Stream of Boxed-FloatsInvokes: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)Passes: A Float-Retrieval Settings-Record. See: Class JFlagfor information about the'FLAGS'parameter.Producing a Boxed-Float Array from this Method is as Follows:
Java Line of Code:
Float[] arr = RJArrIntoBoxedStream .floatArr(ja, 0, 0, null) .toArray(Float[]::new);
- See Also:
ProcessJsonArray.numericToJava(JsonArray, SettingsRec),floatRec(float, int, Function)- Code:
- Exact Method Body:
return ProcessJsonArray.numericToJava (ja, floatRec(defaultValue, FLAGS, optionalUserParser));
-
booleanArr
public static java.util.stream.Stream<java.lang.Boolean> booleanArr (JsonArray ja, boolean defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Boolean> optionalUserParser)
Generate a Java Stream of Boxed-BooleansInvokes: Method ProcessJsonArray.booleanToJava(JsonArray, SettingsRec)Passes: A Boolean-Retrieval Settings-Record. See: Class JFlagfor information about the'FLAGS'parameter.Producing a Boxed-Boolean Array from this Method is as Follows:
Java Line of Code:
Boolean[] arr = RJArrIntoBoxedStream .booleanArr(ja, true, 0, null) .toArray(Boolean[]::new);
- See Also:
ProcessJsonArray.booleanToJava(JsonArray, SettingsRec),booleanRec(boolean, int, Function)- Code:
- Exact Method Body:
return ProcessJsonArray.booleanToJava (ja, booleanRec(defaultValue, FLAGS, optionalUserParser));
-
numberArr
public static java.util.stream.Stream<java.lang.Number> numberArr (JsonArray ja, java.lang.Number defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Number> optionalUserParser)
Generate a Java Stream of Best-Fit Boxed-NumbersInvokes: Method ProcessJsonArray.numericToJava(JsonArray, SettingsRec)Passes: A Number-Retrieval Settings-Record. See: Class JFlagfor information about the'FLAGS'parameter.Producing a Boxed-Number Array from this Method is as Follows:
Java Line of Code:
Number[] arr = RJArrIntoBoxedStream .numberArr(ja, 0, 0, null) .toArray(Number[]::new);
- See Also:
ProcessJsonArray.numericToJava(JsonArray, SettingsRec),numberRec(Number, int, Function)- Code:
- Exact Method Body:
return ProcessJsonArray.numericToJava (ja, numberRec(defaultValue, FLAGS, optionalUserParser));
-
intRec
public static SettingsRec<java.lang.Integer,java.util.stream.Stream<java.lang.Integer>> intRec (int defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Integer> optionalUserParser)
Generate a Settings-Record for a Stream of Boxed-IntegersGenerates: 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.Producing a Boxed-Number Stream by using this record is a two step process. It may be acheived as Follows:
Example:
SettingsRec<Integer, Stream<Integer>> rec = RJArrIntoBoxedStream.intRec(0, 0, null); // Reuse the same record in each loop-iteration: only 1 Constructor-Invocation for (JsonArray ja : someJsonArraySource) ProcessJsonArray .numericToJava(ja, rec) // Returns a Stream<Integer> .forEach(System.out::println); // Prints out each number in the stream
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Integer, Stream<Integer>> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_INTEGER()) .streams();
-
shortRec
public static SettingsRec<java.lang.Short,java.util.stream.Stream<java.lang.Short>> shortRec (short defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Short> optionalUserParser)
Generate a Settings-Record for a Stream of Boxed Short-IntegersGenerates: 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.Producing a Boxed-Number Stream by using this record is a two step process. It may be acheived as Follows:
Example:
SettingsRec<Short, Stream<Short>> rec = RJArrIntoBoxedStream.shortRec(0, 0, null); // Reuse the same record in each loop-iteration: only 1 Constructor-Invocation for (JsonArray ja : someJsonArraySource) ProcessJsonArray .numericToJava(ja, rec) // Returns a Stream<Short> .forEach(System.out::println); // Prints out each number in the stream
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Short, Stream<Short>> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_SHORT()) .streams();
-
byteRec
public static SettingsRec<java.lang.Byte,java.util.stream.Stream<java.lang.Byte>> byteRec (byte defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Byte> optionalUserParser)
Generate a Settings-Record for a Stream of Boxed-BytesGenerates: 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.Producing a Boxed-Number Stream by using this record is a two step process. It may be acheived as Follows:
Example:
SettingsRec<Byte, Stream<Byte>> rec = RJArrIntoBoxedStream.byteRec(0, 0, null); // Reuse the same record in each loop-iteration: only 1 Constructor-Invocation for (JsonArray ja : someJsonArraySource) ProcessJsonArray .numericToJava(ja, rec) // Returns a Stream<Byte> .forEach(System.out::println); // Prints out each number in the stream
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Byte, Stream<Byte>> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_BYTE()) .streams();
-
longRec
public static SettingsRec<java.lang.Long,java.util.stream.Stream<java.lang.Long>> longRec (long defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Long> optionalUserParser)
Generate a Settings-Record for a Stream of Boxed Long-IntegersGenerates: 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.Producing a Boxed-Number Stream by using this record is a two step process. It may be acheived as Follows:
Example:
SettingsRec<Long, Stream<Long>> rec = RJArrIntoBoxedStream.longRec(0, 0, null); // Reuse the same record in each loop-iteration: only 1 Constructor-Invocation for (JsonArray ja : someJsonArraySource) ProcessJsonArray .numericToJava(ja, rec) // Returns a Stream<Long> .forEach(System.out::println); // Prints out each number in the stream
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Long, Stream<Long>> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_LONG()) .streams();
-
doubleRec
public static SettingsRec<java.lang.Double,java.util.stream.Stream<java.lang.Double>> doubleRec (double defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Double> optionalUserParser)
Generate a Settings-Record for a Stream of Boxed-DoublesGenerates: 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.Producing a Boxed-Number Stream by using this record is a two step process. It may be acheived as Follows:
Example:
SettingsRec<Double, Stream<Double>> rec = RJArrIntoBoxedStream.doubleRec(0, 0, null); // Reuse the same record in each loop-iteration: only 1 Constructor-Invocation for (JsonArray ja : someJsonArraySource) ProcessJsonArray .numericToJava(ja, rec) // Returns a Stream<Double> .forEach(System.out::println); // Prints out each number in the stream
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Double, Stream<Double>> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_DOUBLE()) .streams();
-
floatRec
public static SettingsRec<java.lang.Float,java.util.stream.Stream<java.lang.Float>> floatRec (float defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Float> optionalUserParser)
Generate a Settings-Record for a Stream of Boxed-FloatsGenerates: 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.Producing a Boxed-Number Stream by using this record is a two step process. It may be acheived as Follows:
Example:
SettingsRec<Float, Stream<Float>> rec = RJArrIntoBoxedStream.floatRec(0, 0, null); // Reuse the same record in each loop-iteration: only 1 Constructor-Invocation for (JsonArray ja : someJsonArraySource) ProcessJsonArray .numericToJava(ja, rec) // Returns a Stream<Float> .forEach(System.out::println); // Prints out each number in the stream
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Float, Stream<Float>> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_FLOAT()) .streams();
-
booleanRec
public static SettingsRec<java.lang.Boolean,java.util.stream.Stream<java.lang.Boolean>> booleanRec (boolean defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Boolean> optionalUserParser)
Generate a Settings-Record for a Stream of Boxed-BooleansGenerates: 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.Producing a Boxed-Number Stream by using this record is a two step process. It may be acheived as Follows:
Example:
SettingsRec<Boolean, Stream<Boolean>> rec = RJArrIntoBoxedStream.booleanRec(true, 0, null); // Reuse the same record in each loop-iteration: only 1 Constructor-Invocation for (JsonArray ja : someJsonArraySource) ProcessJsonArray .booleanToJava(ja, rec) // Returns a Stream<Boolean> .forEach(System.out::println); // Prints out each number in the stream
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Boolean, Stream<Boolean>> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.BOXED_BOOLEAN()) .streams();
-
numberRec
public static SettingsRec<java.lang.Number,java.util.stream.Stream<java.lang.Number>> numberRec (java.lang.Number defaultValue, int FLAGS, java.util.function.Function<java.lang.String,java.lang.Number> optionalUserParser)
Generate a Settings-Record for a Stream of Best-Fit Boxed-NumbersGenerates: 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.Producing a Boxed-Number Stream by using this record is a two step process. It may be acheived as Follows:
Example:
SettingsRec<Number, Stream<Number>> rec = RJArrIntoBoxedStream.numberRec(0, 0, null); // Reuse the same record in each loop-iteration: only 1 Constructor-Invocation for (JsonArray ja : someJsonArraySource) ProcessJsonArray .numericToJava(ja, rec) // Returns a Stream<Number> .forEach(System.out::println); // Prints out each number in the stream
- Code:
- Exact Method Body:
return new SETTINGS_REC_BUILDER<Number, Stream<Number>> (defaultValue, FLAGS, optionalUserParser, BASIC_TYPES.NUMBER_REC()) .streams();
-
-