Package Torello.JSON
Class ProcessMultiDimJsonArray
- java.lang.Object
-
- Torello.JSON.ProcessMultiDimJsonArray
-
public class ProcessMultiDimJsonArray extends java.lang.Object
Hi-Lited Source-Code:- View Here: Torello/JSON/ProcessMultiDimJsonArray.java
- Open New Browser-Tab: Torello/JSON/ProcessMultiDimJsonArray.java
File Size: 7,806 Bytes Line Count: 189 '\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
- 3 Method(s), 3 declared static
- 0 Field(s)
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method protected static <T> Class<T>CHECK_ARRAY_CLASS(Class<T> retArrClass, Class<?> expectedRootClass)static <BASIC_TYPE,
STREAM_TYPE,
RETURN_ARR_TYPE>
RETURN_ARR_TYPEjsonArrayToJava(JsonArray ja, SettingsRec<BASIC_TYPE,STREAM_TYPE> rec, Class<RETURN_ARR_TYPE> retArrClass)
-
-
-
Method Detail
-
jsonArrayToJava
public static <BASIC_TYPE,STREAM_TYPE,RETURN_ARR_TYPE> RETURN_ARR_TYPE jsonArrayToJava (JsonArray ja, SettingsRec<BASIC_TYPE,STREAM_TYPE> rec, java.lang.Class<RETURN_ARR_TYPE> retArrClass)
This class is invoked by the classRJArrDimN- Type Parameters:
BASIC_TYPE- The "Component Type" of the Output-Array.STREAM_TYPE- The "Intermediate Stream Type", which is present before the conversion to an Array.RETURN_ARR_TYPE- The actual Return-Type of the method. This must be an Array-Class, such asint[][].classor (in the case of Boxed-Type Arrays)Integer[][].- Parameters:
ja- Any instance ofJsonArray. The contents sof this array should match the dimensionality of the expected Output-Array Type, or an exception will likelyy throw.rec- An instance ofSettingsRecthat's been configured to return a multi-dimensional array.retArrClass- The class of the return array.- Returns:
- An instance of
'retArrClass' - Code:
- Exact Method Body:
CHECK_ARRAY_CLASS(retArrClass, rec.CLASS); return jsonArrayToJava_INTERNAL(ja, rec, retArrClass);
-
CHECK_ARRAY_CLASS
protected static <T> java.lang.Class<T> CHECK_ARRAY_CLASS (java.lang.Class<T> retArrClass, java.lang.Class<?> expectedRootClass)
Check user input, and throws exceptions if the array-class has not been properly chosen.- Parameters:
retArrClass- This must be a primitive-array class, possibly of multiple dimensionsexpectedRootClass- The expected "root class". Forint[][].class, the root class would beint.class.- Returns:
- Parameter
retArrClassis the return value of this checker method - Throws:
IllegalArgumentExcetion- If parameter retArrClass: If calling retArrClass.isArray() returns FALSE If the root-array type is not the appropriate type for the method that was called- Code:
- Exact Method Body:
Objects.requireNonNull(retArrClass, "Return-Array Type, Parameter 'retArrClass' is null"); if (! retArrClass.isArray()) throw new IllegalArgumentException( "The class you have passed to parameter 'retArrClass' " + "[" + retArrClass.getSimpleName() + "], is not an array" ); Class<?> componentClass = retArrClass.getComponentType(); while (componentClass.isArray()) componentClass = componentClass.getComponentType(); if (! expectedRootClass.equals(componentClass)) throw new IllegalArgumentException( "The class you have passed to parameter 'retArrClass' " + "[" + retArrClass.getSimpleName() + "], is not a(n) " + expectedRootClass.getSimpleName() + "-array." ); return retArrClass;
-
-