Package Torello.JSON
Class JFlag
- java.lang.Object
-
- Torello.JSON.JFlag
-
public class JFlag extends java.lang.Object
Exception-Flags that may be passed to theReadJSONmethods which accept a'FLAGS'parameter.
FLAG PRECEDENCE:
If a user actually has multiple masks for the same error case, classReadJSONhas an internal precedence / priority used for obeying the user-provided flag-masks. The flags that handle "On Any" or "On All" are always obeyed last. If the user has provided error or exception specific flags, those always take precedence over the "Any & All" mask.
SPECIFICALLY:RETURN_NULL_ON_WRONG_JSONTYPEtakes precedence overRETURN_DEFVAL_ON_ANY_ALL
If a user has provided multiple masks for the same case, and both of those masks are error or exception flags, then a 'null' return takes precedence over a default-value return.
SPECIFICALLY:RETURN_NULL_ON_WRONG_JSONTYPEtakes precedence overRETURN_DEFVAL_ON_WRONG_JSONTYPE
ROCKET-SCIENCE NOTE:
The following code has been directly cut and pasted - from one of the internal,protected'GET'methods found inRJInternal. It is the code for handling an'ArrayIndexOutOfBoundsException'. (See below that the Flag Precedence rules are pretty straight-forward - and certainly are not rocket-science!).
if (index >= ja.size()) { if ((FLAGS & RETURN_NULL_ON_IOB) != 0) return null; if ((FLAGS & RETURN_DEFVAL_ON_IOB) != 0) return defaultValue; if ((FLAGS & RETURN_NULL_ON_ANY_ALL) != 0) return null; if ((FLAGS & RETURN_DEFVAL_ON_ANY_ALL) != 0) return defaultValue; ja.get(index); // Throw an IndexOutOfBoundsException }
The complete set of handlers for these flags may be viewed inside the exception-handler methods in classRJInternal.
The flag-handlers for theRJArrIntoPrimArrayandRJArrDimNclasses are available for viewing (but buried) inside that class. To see those flag-handlers / exception-case-handlers, simply click theHILITEDbutton in the Navigation Bar there (or theView Here:link on that page).
Java Bit-Wise Logic Syntax:
As a simple reminder for how to "glue" together several flags, the following (simple) bit-wise operator allows the programmer to place several flags inside of a single integer:
Java Line of Code:
int myFlags = RETURN_DEFVAL_ON_ANY_ALL | RETURN_PARSE_ON_STR | RETURN_JAPPROX_ON_AEX;
The above flags-integer would guarantee that any / allJsonStringelements found which are intended to be represented as numbers are parsed into numbers. It would furthermore use the standard JDK "rounding process" for numbers that will not fit into their desired type.
Any other exceptions that might occur while processing a Json Element will produce whatever Default-Value has been passed to the method parameterdefaultValue.
Null-Flags & Primitives:
There are quite a number of flags in this class that allow a user to request that certain values be returned when a "null" is encountered in a Json-Object or Array. Furthermore, there are also flags that provide a means for to request'null'be returned under certain Error-Conditions or when unacceptable values are retrieved.
AnyJFlagthat is would intend a'null'to be returned from a function that returns primitives, or anyJFlagthat asks'null'be inserted into a Primitive-Array, Primitive-Stream or sent to a Primitive-Consumer will be, summarily, ignored.
It should be clear that although aNullPointerExceptioncould, theoretically, be thrown in such circumstances, because this Java-JSON Package tries to heavily emphasize detailed Exception-Throws in Error-Situations, the usual NPE is not used in this package. In fact, what actually does happen is a non-trivial decision process that needs some clarifying.
If aJFlagis passed to a method that requests Java-Null be returned to a method that returns primitives, or assigns or passes primitives to other Data-Structures, then:- That
JFlagis simply ignored, and treated as if its bit-mask simply had not been passed as element of the input'FLAGS'parameter. - If the scenario that is addressed by the flag which is being ignored would result in a
particular
JsonExeptionbeing thrown, then that case-specific exception shall throw. - It is most important to recognize that passing a Null-Return
JFlagto the method of a class that deals with Java-Primitives, in and of itself, will not cause an exception to throw. Instead, and quite the contrary, incongruous flags are simply ignored, and the Error-Case addressed by the ignored flag is never encountered, then no exception shall throw.
Here is brief sample of the logic which deals with "Null-Requesting Flags". Note that the variable'NULLS'is false whenever the output is a primitive.
if (NULLS && ((FLAGS & RETURN_NULL_ON_SPEX) > 0)) handlerSPEX = this::AN; else if ((FLAGS & RETURN_DEFVAL_ON_SPEX) > 0) handlerSPEX = this::AD; else if ((FLAGS & SKIP_ON_SPEX) > 0) handlerSPEX = this::NOOP; else if (NULLS && RN_AA) handlerSPEX = this::AN; else if (RD_AA) handlerSPEX = this::AD; else if (S_AA) handlerSPEX = this::NOOP; else handlerSPEX = null;
In the above code-snippet, if the user has requested that a 'null' be returned whenever an exception should throw due to a faultyString-Parse operation, instead, that request is ignored if variable'NULLS'isFALSE. In such a scenario, if there are no other pertinentJFlag-Masks that reside inside the'FLAGS'parameter, then whateverString-Parse exception was going to be avoided, instead, throws.
Hi-Lited Source-Code:- View Here: Torello/JSON/JFlag.java
- Open New Browser-Tab: Torello/JSON/JFlag.java
File Size: 35,029 Bytes Line Count: 740 '\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
- 0 Method(s)
- 61 Field(s), 61 declared static, 61 declared final
- That
-
-
Field Summary
One-Size-Fits-All Flags, which may handle all exception & error cases Modifier and Type Field static intRETURN_DEFVAL_ON_ANY_ALLstatic intRETURN_NULL_ON_ANY_ALLstatic intSKIP_ON_ANY_ALLOne-Size-Fits-All Flags, abbreviated Modifier and Type Field static intRD_AAstatic intRN_AAstatic intS_AAFlags which request null return on error Modifier and Type Field static intRETURN_NULL_ON_0LEN_STRstatic intRETURN_NULL_ON_AEXstatic intRETURN_NULL_ON_IOBstatic intRETURN_NULL_ON_MISSINGstatic intRETURN_NULL_ON_NULLstatic intRETURN_NULL_ON_SPEXstatic intRETURN_NULL_ON_WRONG_JSONTYPEFlags (abbreviated) which request null return on error Modifier and Type Field static intRN_AEXstatic intRN_IOBstatic intRN_Mstatic intRN_Nstatic intRN_SPEXstatic intRN_WTstatic intRN_ZLSFlags which request default-value return on error Modifier and Type Field static intRETURN_DEFVAL_ON_0LEN_STRstatic intRETURN_DEFVAL_ON_AEXstatic intRETURN_DEFVAL_ON_IOBstatic intRETURN_DEFVAL_ON_MISSINGstatic intRETURN_DEFVAL_ON_NULLstatic intRETURN_DEFVAL_ON_SPEXstatic intRETURN_DEFVAL_ON_WRONG_JSONTYPEFlags (abbreviated) which request default-value return on error Modifier and Type Field static intRD_AEXstatic intRD_IOBstatic intRD_Mstatic intRD_Nstatic intRD_SPEXstatic intRD_WTstatic intRD_ZLSFlags for requesting rounded / approximated value return on error Modifier and Type Field static intRETURN_JAPPROX_ON_AEXstatic intRJA_AEXFlags used only for reading JsonArray'sModifier and Type Field static intRETURN_DEFVAL_ON_STRstatic intRETURN_NULL_ON_STRstatic intRETURN_PARSE_ON_STRstatic intSKIP_ON_0LEN_STRstatic intSKIP_ON_AEXstatic intSKIP_ON_NULLstatic intSKIP_ON_SPEXstatic intSKIP_ON_STRstatic intSKIP_ON_WRONG_JSONTYPEFlags (abbreviated) used only for reading JsonArray'sModifier and Type Field static intRD_Sstatic intRN_Sstatic intRP_Sstatic intS_AEXstatic intS_Nstatic intS_Sstatic intS_SPEXstatic intS_WTstatic intS_ZLSFlags used by ReadArrJSON.strArrayToStream(...)Modifier and Type Field static intRETURN_TOSTRING_ON_WRONGTYPEstatic intRTS_WTFlags used only by class RJArrDimN(for reading multi-dimensionalJsonArray's)Modifier and Type Field static intINSERT_NULL_ON_NON_SUBARRAY_TYPEstatic intSKIP_ON_NON_SUBARRAY_TYPEFlags (abbreviated) used only by class RJArrDimNModifier and Type Field static intIN_NSATstatic intS_NSATFlags that are disallowed when used with Primitive Data-Types Modifier and Type Field static intNOT_ALLOWED_RET_NULL_MASKS
-
-
-
Field Detail
-
RETURN_NULL_ON_ANY_ALL
public static final int RETURN_NULL_ON_ANY_ALL
This is a "Primary Flag" that indicates the reader should always return null for any exception-throw or error case that could possibly occur.
Flag Precedence:
When this flag is set, it always has the lowest precedence compared to all other flags. Specifically, if this flag, and the flagRETURN_DEFVAL_ON_AEXwere both set, and anArithmeticExceptionwere going to be thrown, the user-provided default-value would be returned, rather than null.
If both flagRN_AAandRD_AAare set, 'null' will always be returned, rather than the default-value.
Abbreviation:
The flag-maskRN_AAis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RETURN_NULL_ON_ANY_ALL = 1;
-
RN_AA
public static final int RN_AA
Identical to flag-mask fieldRETURN_NULL_ON_ANY_ALL- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RN_AA = RETURN_NULL_ON_ANY_ALL;
-
RETURN_DEFVAL_ON_ANY_ALL
public static final int RETURN_DEFVAL_ON_ANY_ALL
This is a "Primary Flag" that indicates the reader should always return the user-provided default-value for any exception-throw or error case that could possibly occur.
Flag Precedence:
When this flag is set, it always has the lowest precedence compared to all other flags. Specifically, if this flag, and the flagRETURN_NULL_ON_AEXwere both set, and anArithmeticExceptionwere going to be thrown, null would be returned, rather than the user-provided default-value.
If both flagRN_AAandRD_AAare set, 'null' will always be returned, rather than the default-value.
Abbreviation:
The flag-maskRN_AAis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RETURN_DEFVAL_ON_ANY_ALL = RN_AA << 1;
-
RD_AA
public static final int RD_AA
Identical to flag-mask fieldRETURN_DEFVAL_ON_ANY_ALL- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RD_AA = RETURN_DEFVAL_ON_ANY_ALL;
-
RETURN_NULL_ON_IOB
public static final int RETURN_NULL_ON_IOB
Instructs a get method to return null if anIndexOutOfBoundsExceptionwould otherwise be thrown. This flag-mask is only useful with methods that acceptJsonArrayand'index'parameters.
Abbreviation:
The flag-maskRN_IOBis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RETURN_NULL_ON_IOB = RD_AA << 1;
-
RN_IOB
public static final int RN_IOB
Identical to flag-mask fieldRETURN_NULL_ON_IOB- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RN_IOB = RETURN_NULL_ON_IOB;
-
RETURN_DEFVAL_ON_IOB
public static final int RETURN_DEFVAL_ON_IOB
Instructs a get method to return the user-provided'defaultValue'if anIndexOutOfBoundsExceptionwould otherwise be thrown. This flag-mask is only useful to methods which acceptJsonArrayand'index'parameters.
Abbreviation:
The flag-maskRD_IOBis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RETURN_DEFVAL_ON_IOB = RN_IOB << 1;
-
RD_IOB
public static final int RD_IOB
Identical to flag-mask fieldRETURN_DEFVAL_ON_IOB- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RD_IOB = RETURN_DEFVAL_ON_IOB;
-
RETURN_NULL_ON_MISSING
public static final int RETURN_NULL_ON_MISSING
Instructs a get method to return null when a specified property isn't actually present in aJsonObject. This flag-mask is only useful to methods that accept a'propertyName'andJsonObjectparameter.
Abbreviation:
The flag-maskRN_Mis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
JsonPropMissingException, Constant Field Values- Code:
- Exact Field Declaration Expression:
public static final int RETURN_NULL_ON_MISSING = RD_IOB << 1;
-
RN_M
public static final int RN_M
Identical to flag-mask fieldRETURN_NULL_ON_MISSING- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RN_M = RETURN_NULL_ON_MISSING;
-
RETURN_DEFVAL_ON_MISSING
public static final int RETURN_DEFVAL_ON_MISSING
Instructs a get method to return a user-provided'defaultValue'when a specified property isn't actually present in aJsonObject. This flag-mask is only useful to methods that accept a'propertyName'andJsonObjectparameter.
Abbreviation:
The flag-maskRD_Mis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
JsonPropMissingException, Constant Field Values- Code:
- Exact Field Declaration Expression:
public static final int RETURN_DEFVAL_ON_MISSING = RN_M << 1;
-
RD_M
public static final int RD_M
Identical to flag-mask fieldRETURN_DEFVAL_ON_MISSING- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RD_M = RETURN_DEFVAL_ON_MISSING;
-
RETURN_NULL_ON_NULL
public static final int RETURN_NULL_ON_NULL
Instructs a get method to return Java-Null whenever aJsonObjectproperty orJsonArrayindex contains Json-Null.
Abbreviation:
The flag-maskRN_Nis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
JsonNullArrException,JsonNullObjException,JsonNullPrimitiveArrException,JsonNullPrimitiveObjException, Constant Field Values- Code:
- Exact Field Declaration Expression:
public static final int RETURN_NULL_ON_NULL = RD_M << 1;
-
RN_N
public static final int RN_N
Identical to flag-mask fieldRETURN_NULL_ON_NULL- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RN_N = RETURN_NULL_ON_NULL;
-
RETURN_DEFVAL_ON_NULL
public static final int RETURN_DEFVAL_ON_NULL
Instructs a get method to return a user-provided'defaultValue'whenever aJsonObjectproperty orJsonArrayindex contains Json-Null.
Abbreviation:
The flag-maskRD_Nis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
JsonNullArrException,JsonNullObjException,JsonNullPrimitiveArrException,JsonNullPrimitiveObjException, Constant Field Values- Code:
- Exact Field Declaration Expression:
public static final int RETURN_DEFVAL_ON_NULL = RN_N << 1;
-
RD_N
public static final int RD_N
Identical to flag-mask fieldRETURN_DEFVAL_ON_NULL- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RD_N = RETURN_DEFVAL_ON_NULL;
-
RETURN_NULL_ON_AEX
public static final int RETURN_NULL_ON_AEX
Instructs a get method to return null if anArithmeticExceptionwould otherwise be thrown.
Abbreviation:
The flag-maskRN_AEXis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
JsonArithmeticArrException,JsonArithmeticObjException, Constant Field Values- Code:
- Exact Field Declaration Expression:
public static final int RETURN_NULL_ON_AEX = RD_N << 1;
-
RN_AEX
public static final int RN_AEX
Identical to flag-mask fieldRETURN_NULL_ON_AEX- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RN_AEX = RETURN_NULL_ON_AEX;
-
RETURN_DEFVAL_ON_AEX
public static final int RETURN_DEFVAL_ON_AEX
Instructs a get method to return the user-provided'defaultValue'if anArithmeticExceptionwould otherwise be thrown.
Abbreviation:
The flag-maskRD_AEXis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
JsonArithmeticArrException,JsonArithmeticObjException, Constant Field Values- Code:
- Exact Field Declaration Expression:
public static final int RETURN_DEFVAL_ON_AEX = RN_AEX << 1;
-
RD_AEX
public static final int RD_AEX
Identical to flag-mask fieldRETURN_DEFVAL_ON_AEX- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RD_AEX = RETURN_DEFVAL_ON_AEX;
-
RETURN_JAPPROX_ON_AEX
public static final int RETURN_JAPPROX_ON_AEX
Instructs a get method to use a Standard Java Alternative / Rounding Method if anArithmeticExceptionwould otherwise be thrown.
The exact process for 'fitting' a number that is too big for a particular primitive is the implemented in classjava.math.BigDecimal. Below are the explanations for fitting a number into anintand afloat.
Description copied from class:java.math.BigDecimal.intValue(), JDK 1.8
This conversion is analogous to the narrowing primitive conversion fromdoubletoshortas defined in section 5.1.3 of The Java™ Language Specification: any fractional part of thisBigDecimalwill be discarded, and if the resulting "BigInteger" is too big to fit in anint, only the low-order 32 bits are returned. Note that this conversion can lose information about the overall magnitude and precision of thisBigDecimalvalue as well as return a result with the opposite sign.
Description copied from class:java.math.BigDecimal.floatValue(), JDK 1.8
This conversion is similar to the narrowing primitive conversion fromdoubletofloatas defined in section 5.1.3 of The Java™ Language Specification: if thisBigDecimalhas too great a magnitude to represent as afloat, it will be converted toFloat.NEGATIVE_INFINITYorFloat.POSITIVE_INFINITYas appropriate. Note that even when the return value is finite, this conversion can lose information about the precision of theBigDecimalvalue.
Abbreviation:
The flag-maskRJA_AEXis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
JsonArithmeticArrException,JsonArithmeticObjException, Constant Field Values- Code:
- Exact Field Declaration Expression:
public static final int RETURN_JAPPROX_ON_AEX = RD_AEX << 1;
-
RJA_AEX
public static final int RJA_AEX
Identical to flag-mask fieldRETURN_JAPPROX_ON_AEX- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RJA_AEX = RETURN_JAPPROX_ON_AEX;
-
RETURN_NULL_ON_WRONG_JSONTYPE
public static final int RETURN_NULL_ON_WRONG_JSONTYPE
Instructs a get method to return null in cases where aJsonObjectproperty orJsonArrayindex does not contain the expected Json-Type
Abbreviation:
The flag-maskRN_WTis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
JsonTypeArrException,JsonTypeObjException, Constant Field Values- Code:
- Exact Field Declaration Expression:
public static final int RETURN_NULL_ON_WRONG_JSONTYPE = RJA_AEX << 1;
-
RN_WT
public static final int RN_WT
Identical to flag-mask fieldRETURN_NULL_ON_WRONG_JSONTYPE- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RN_WT = RETURN_NULL_ON_WRONG_JSONTYPE;
-
RETURN_DEFVAL_ON_WRONG_JSONTYPE
public static final int RETURN_DEFVAL_ON_WRONG_JSONTYPE
Instructs a get method to return the user-provided'defaultValue'in cases where aJsonObjectproperty orJsonArrayindex does not contain the expected Json-Type
Abbreviation:
The flag-maskRD_WTis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
JsonTypeArrException,JsonTypeObjException, Constant Field Values- Code:
- Exact Field Declaration Expression:
public static final int RETURN_DEFVAL_ON_WRONG_JSONTYPE = RN_WT << 1;
-
RD_WT
public static final int RD_WT
Identical to flag-mask fieldRETURN_DEFVAL_ON_WRONG_JSONTYPE- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RD_WT = RETURN_DEFVAL_ON_WRONG_JSONTYPE;
-
RETURN_NULL_ON_0LEN_STR
public static final int RETURN_NULL_ON_0LEN_STR
Instructs a get method to return null in cases where aJsonObjectproperty orJsonArrayindex contains a zero-lengthJsonString
Abbreviation:
The flag-maskRN_ZLSis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RETURN_NULL_ON_0LEN_STR = RD_WT << 1;
-
RN_ZLS
public static final int RN_ZLS
Identical to flag-mask fieldRETURN_NULL_ON_0LEN_STR- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RN_ZLS = RETURN_NULL_ON_0LEN_STR;
-
RETURN_DEFVAL_ON_0LEN_STR
public static final int RETURN_DEFVAL_ON_0LEN_STR
Instructs a get method to return the user-provided'defaultValue'in cases where aJsonObjectproperty orJsonArrayindex contains a zero-lengthJsonString
Abbreviation:
The flag-maskRD_ZLSis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RETURN_DEFVAL_ON_0LEN_STR = RN_ZLS << 1;
-
RD_ZLS
public static final int RD_ZLS
Identical to flag-mask fieldRETURN_DEFVAL_ON_0LEN_STR- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RD_ZLS = RETURN_DEFVAL_ON_0LEN_STR;
-
RETURN_NULL_ON_SPEX
public static final int RETURN_NULL_ON_SPEX
Instructs a get method to return null in cases where the user-provided'parser'function has thrown an exception.
SPEX: String Parse Exception
Abbreviation:
The flag-maskRN_SPEXis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
JsonStrParseArrException,JsonStrParseObjException, Constant Field Values- Code:
- Exact Field Declaration Expression:
public static final int RETURN_NULL_ON_SPEX = RD_ZLS << 1;
-
RN_SPEX
public static final int RN_SPEX
Identical to flag-mask fieldRETURN_NULL_ON_SPEX- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RN_SPEX = RETURN_NULL_ON_SPEX;
-
RETURN_DEFVAL_ON_SPEX
public static final int RETURN_DEFVAL_ON_SPEX
Instructs a get method to return the user-provided'defaultValue'in cases where the user-provided'parser'function has thrown an exception.
SPEX: String Parse Exception
Abbreviation:
The flag-maskRD_SPEXis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
JsonStrParseArrException,JsonStrParseObjException, Constant Field Values- Code:
- Exact Field Declaration Expression:
public static final int RETURN_DEFVAL_ON_SPEX = RN_SPEX << 1;
-
RD_SPEX
public static final int RD_SPEX
Identical to flag-mask fieldRETURN_DEFVAL_ON_SPEX- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RD_SPEX = RETURN_DEFVAL_ON_SPEX;
-
SKIP_ON_ANY_ALL
public static final int SKIP_ON_ANY_ALL
This is a "Primary Flag" that indicates the reader should always skip any array-entry for any exception-throw or error case that could possibly occur.
Flag Precedence:
When this flag is set, it always has the lowest precedence compared to all other flags. Specifically, if this flag, and the flagRETURN_DEFVAL_ON_AEXwere both set, and anArithmeticExceptionwere going to be thrown, the user-provided default-value would be placed into the output, rather than being skipped.
If both flagS_AAandRN_AAare set, 'null' will always be placed into the output, before skipping the array-index, or using the default-value.
Abbreviation:
The flag-maskS_AAis an abbreviated but identical value that may be used if brevity is a higher priority than readability.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int SKIP_ON_ANY_ALL = RD_SPEX << 1;
-
S_AA
public static final int S_AA
Identical to flag-mask fieldSKIP_ON_ANY_ALL- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int S_AA = SKIP_ON_ANY_ALL;
-
SKIP_ON_NULL
public static final int SKIP_ON_NULL
Instructs an array / stream builder method to skip an array element, if-and-when aJsonArrayindex contain a Json-Null.
When an array-index location is skipped during a converstion, the returned stream will simply have a size shorter than the inputJsonArray'ssize, shortened by the number of skipped-indices.
Abbreviation:
The flag-maskS_Nis an abbreviated but identical value that may be used if brevity is a higher priority than readability.
For Reading Arrays Only:
This flag is ignored, completely, by all methods inReadJSON, and is only useful inRJArrIntoPrimArray. Any flag which begins with'SKIP'will only be applied to array-processing methods.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int SKIP_ON_NULL = S_AA << 1;
-
S_N
public static final int S_N
Identical to flag-mask fieldSKIP_ON_NULL- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int S_N = SKIP_ON_NULL;
-
SKIP_ON_AEX
public static final int SKIP_ON_AEX
Instructs an array / stream builder method to skip an array element, if-and-when if anArithmeticExceptionwould otherwise be thrown.
When an array-index location is skipped during a converstion, the returned stream will simply have a size shorter than the inputJsonArray'ssize, shortened by the number of skipped-indices.
Abbreviation:
The flag-maskS_AEXis an abbreviated but identical value that may be used if brevity is a higher priority than readability.
For Reading Arrays Only:
This flag is ignored, completely, by all methods inReadJSON, and is only useful inRJArrIntoPrimArray. Any flag which begins with'SKIP'will only be applied to array-processing methods.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int SKIP_ON_AEX = S_N << 1;
-
S_AEX
public static final int S_AEX
Identical to flag-mask fieldSKIP_ON_AEX- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int S_AEX = SKIP_ON_AEX;
-
RETURN_PARSE_ON_STR
public static final int RETURN_PARSE_ON_STR
Instructs an array / stream builder method to parse an array element into a number, if-and-when aJsonStringis encountered.
Abbreviation:
The flag-maskRP_Sis an abbreviated but identical value that may be used if brevity is a higher priority than readability.
For Reading Arrays Only:
This flag is ignored, completely, by all methods inReadJSON, and is only useful inRJArrIntoPrimArray.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RETURN_PARSE_ON_STR = S_AEX << 1;
-
RP_S
public static final int RP_S
Identical to flag-mask fieldRETURN_PARSE_ON_STR- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RP_S = RETURN_PARSE_ON_STR;
-
RETURN_NULL_ON_STR
public static final int RETURN_NULL_ON_STR
Instructs a boxed-stream builder method to insert Java-Null into the boxed-stream whenever aJsonArrayindex contains aJsonString.
This flag is ignored if passed to a primitive-stream builder method. A primitive-stream (and its associated builder) will not accept nulls.
Abbreviation:
The flag-maskRN_Sis an abbreviated but identical value that may be used if brevity is a higher priority than readability.
For Reading Arrays Only:
This flag is ignored, completely, by all methods inReadJSON, and is only useful inRJArrIntoPrimArray.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RETURN_NULL_ON_STR = RP_S << 1;
-
RN_S
public static final int RN_S
Identical to flag-mask fieldRETURN_NULL_ON_STR- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RN_S = RETURN_NULL_ON_STR;
-
RETURN_DEFVAL_ON_STR
public static final int RETURN_DEFVAL_ON_STR
Instructs an array / stream builder method to insert the user-provided'defaultValue'whenever aJsonStringis encountered at a particular index inside aJsonArray.
Abbreviation:
The flag-maskRD_Sis an abbreviated but identical value that may be used if brevity is a higher priority than readability.
For Reading Arrays Only:
This flag is ignored, completely, by all methods inReadJSON, and is only useful inRJArrIntoPrimArray.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RETURN_DEFVAL_ON_STR = RN_S << 1;
-
RD_S
public static final int RD_S
Identical to flag-mask fieldRETURN_DEFVAL_ON_STR- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RD_S = RETURN_DEFVAL_ON_STR;
-
SKIP_ON_STR
public static final int SKIP_ON_STR
Instructs an array / stream builder method to skip anyJsonArrayindex-locations that contain aJsonString.
When an array-index location is skipped during a converstion, the returned stream will simply have a size shorter than the inputJsonArray'ssize, shortened by the number of skipped-indices.
Abbreviation:
The flag-maskS_Sis an abbreviated but identical value that may be used if brevity is a higher priority than readability.
For Reading Arrays Only:
This flag is ignored, completely, by all methods inReadJSON, and is only useful inRJArrIntoPrimArray. Any flag which begins with'SKIP'will only be applied to array-processing methods.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int SKIP_ON_STR = RD_S << 1;
-
S_S
public static final int S_S
Identical to flag-mask fieldSKIP_ON_STR- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int S_S = SKIP_ON_STR;
-
SKIP_ON_0LEN_STR
public static final int SKIP_ON_0LEN_STR
Instructs an array / stream builder method to skip anyJsonArrayindex-locations that contain a Zero-LengthJsonString.
When an array-index location is skipped during a converstion, the returned stream will simply have a size shorter than the inputJsonArray'ssize, shortened by the number of skipped-indices.
Abbreviation:
The flag-maskS_ZLSis an abbreviated but identical value that may be used if brevity is a higher priority than readability.
For Reading Arrays Only:
This flag is ignored, completely, by all methods inReadJSON, and is only useful inRJArrIntoPrimArray. Any flag which begins with'SKIP'will only be applied to array-processing methods.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int SKIP_ON_0LEN_STR = S_S << 1;
-
S_ZLS
public static final int S_ZLS
Identical to flag-mask fieldSKIP_ON_0LEN_STR- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int S_ZLS = SKIP_ON_0LEN_STR;
-
SKIP_ON_SPEX
public static final int SKIP_ON_SPEX
Instructs an array / stream builder method to skip anyJsonArrayindex-locations that contain aJsonStringthat, when parsed, generate any parse-exceptions, such asNumberFormatException.
When an array-index location is skipped during a converstion, the returned stream will simply have a size shorter than the inputJsonArray'ssize, shortened by the number of skipped-indices.
SPEX: String Parse Exception
Abbreviation:
The flag-maskS_SPEXis an abbreviated but identical value that may be used if brevity is a higher priority than readability.
For Reading Arrays Only:
This flag is ignored, completely, by all methods inReadJSON, and is only useful inRJArrIntoPrimArray. Any flag which begins with'SKIP'will only be applied to array-processing methods.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int SKIP_ON_SPEX = S_ZLS << 1;
-
S_SPEX
public static final int S_SPEX
Identical to flag-mask fieldSKIP_ON_SPEX- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int S_SPEX = SKIP_ON_SPEX;
-
SKIP_ON_WRONG_JSONTYPE
public static final int SKIP_ON_WRONG_JSONTYPE
Instructs an array / stream builder method to skip anyJsonArrayindex-locations that contain an inapplicable Json-Type - such asJsonValue.TRUE,JsonValue.FALSE,JsonObject, a nestedJsonArrayetc...
When an array-index location is skipped during a converstion, the returned stream will simply have a size shorter than the inputJsonArray'ssize, shortened by the number of skipped-indices.
Abbreviation:
The flag-maskS_WTis an abbreviated but identical value that may be used if brevity is a higher priority than readability.
For Reading Arrays Only:
This flag is ignored, completely, by all methods inReadJSON, and is only useful inRJArrIntoPrimArray. Any flag which begins with'SKIP'will only be applied to array-processing methods.- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int SKIP_ON_WRONG_JSONTYPE = S_SPEX << 1;
-
S_WT
public static final int S_WT
Identical to flag-mask fieldSKIP_ON_WRONG_JSONTYPE- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int S_WT = SKIP_ON_WRONG_JSONTYPE;
-
RETURN_TOSTRING_ON_WRONGTYPE
public static final int RETURN_TOSTRING_ON_WRONGTYPE
Instructs theStream<String>(array/stream) builder method to invokeJsonValue.toString()whenever a type other thanJsonStringis found in an array position. This flag is only applicable when converting aJsonArrayinto aString[]-Array.
Abbreviation:
The flag-maskRTS_WTis an abbreviated but identical value that may be used if brevity is a higher priority than readability.
For Specific Method Only:
This flag is ignored, completely, by all methods inReadJSON, and is only useful in invocations of methodRJArrIntoStream.strArr(javax.json.JsonArray, java.lang.String, int).- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RETURN_TOSTRING_ON_WRONGTYPE = S_WT << 1;
-
RTS_WT
public static final int RTS_WT
Identical to flag-mask fieldRETURN_TOSTRING_ON_WRONGTYPE- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int RTS_WT = RETURN_TOSTRING_ON_WRONGTYPE;
-
INSERT_NULL_ON_NON_SUBARRAY_TYPE
public static final int INSERT_NULL_ON_NON_SUBARRAY_TYPE
Instructs the multi-dimensional array-builder method to place a null in an array when it encounters aJsonArrayelement that is not a sub-array, but rather some other non-null Json-Type This flag is only applicable when converting aJsonArrayusing one of the multi-dimensional array-processors in classRJArrDimN.
Abbreviation:
The flag-maskIN_NSATis an abbreviated but identical value that may be used if brevity is a higher priority than readability.
For Reading Multi-Dimensional Arrays Only:
This flag is ignored, completely, by all methods inReadJSONand inRJArrIntoPrimArray. It is only used in processing multi-dimensional arrays (by classRJArrDimN).- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int INSERT_NULL_ON_NON_SUBARRAY_TYPE = RTS_WT << 1;
-
IN_NSAT
public static final int IN_NSAT
Identical to flag-mask fieldINSERT_NULL_ON_NON_SUBARRAY_TYPE- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int IN_NSAT = INSERT_NULL_ON_NON_SUBARRAY_TYPE;
-
SKIP_ON_NON_SUBARRAY_TYPE
public static final int SKIP_ON_NON_SUBARRAY_TYPE
Instructs the multi-dimensional array-builder method to skip the element when it encounters aJsonArrayelement that is not a sub-array, but rather some other non-null Json-Type This flag is only applicable when converting aJsonArrayusing one of the multi-dimensional array-processors in classRJArrDimN.
Abbreviation:
The flag-maskS_NSATis an abbreviated but identical value that may be used if brevity is a higher priority than readability.
For Reading Multi-Dimensional Arrays Only:
This flag is ignored, completely, by all methods inReadJSONand inRJArrIntoPrimArray. It is only used in processing multi-dimensional arrays (by classRJArrDimN).- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int SKIP_ON_NON_SUBARRAY_TYPE = IN_NSAT << 1;
-
S_NSAT
public static final int S_NSAT
Identical to flag-mask fieldSKIP_ON_NON_SUBARRAY_TYPE- See Also:
- Constant Field Values
- Code:
- Exact Field Declaration Expression:
public static final int S_NSAT = SKIP_ON_NON_SUBARRAY_TYPE;
-
NOT_ALLOWED_RET_NULL_MASKS
public static final int NOT_ALLOWED_RET_NULL_MASKS
These are eliminated / removed from any call to a method which returns either an array of Java Primitives or a Java Primitive Stream. These are also filtered from a call to class that invokes a Java Primitive-Consumer- See Also:
RJArrIntoPrimStream.intArr(JsonArray, int, int, ToIntFunction),RJArrIntoPrimStream.longArr(JsonArray, long, int, ToLongFunction),RJArrIntoPrimStream.doubleArr(JsonArray, double, int, ToDoubleFunction),RJArrIntoPrimConsumer, Constant Field Values- Code:
- Exact Field Declaration Expression:
public static final int NOT_ALLOWED_RET_NULL_MASKS = ~(RETURN_NULL_ON_ANY_ALL | RETURN_NULL_ON_AEX | RETURN_NULL_ON_NULL | RETURN_NULL_ON_SPEX | RETURN_NULL_ON_STR | RETURN_NULL_ON_0LEN_STR | RETURN_NULL_ON_WRONG_JSONTYPE | INSERT_NULL_ON_NON_SUBARRAY_TYPE);
-
-