Class ArrayCoercion
java.lang.Object
io.github.connellite.util.internal.ArrayCoercion
Array coercion used by
TypeCoercionUtil.-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ArrayCoercion
public ArrayCoercion()
-
-
Method Details
-
coerce
Coercesrawtoward the array typetargetType. The same runtime class is returned as-is. A primitive array and the array of its wrapper are copied throughNumberUtils. Any other array is converted element by element. A non-array source yieldsnull, except aBlobwhen the target isbyte[]and aStringwhen the target is abyteorchararray, primitive or boxed.- Type Parameters:
T- target type- Parameters:
raw- source value, nevernulltargetType- array type to coerce toward- Returns:
- coerced array, or
nullwhenrawcannot be stored intargetType - Throws:
TypeCoercionException- when an element cannot be stored in the target array
-