Class ArrayBuilder
java.lang.Object
org.apache.commons.jexl3.internal.ArrayBuilder
- All Implemented Interfaces:
JexlArithmetic.ArrayBuilder
Helper class to create typed arrays.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
Number of added items.The boxing types to primitive conversion map.protected Class<?>
The intended class array.protected boolean
Whether the array stores numbers.private static final int
The number of primitive types.protected boolean
Whether we can try unboxing.protected final Object[]
The untyped list of items being added. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
PRIMITIVE_SIZE
private static final int PRIMITIVE_SIZEThe number of primitive types.- See Also:
-
BOXING_CLASSES
The boxing types to primitive conversion map. -
commonClass
The intended class array. -
isNumber
protected boolean isNumberWhether the array stores numbers. -
unboxing
protected boolean unboxingWhether we can try unboxing. -
untyped
The untyped list of items being added. -
added
protected int addedNumber of added items.
-
-
Constructor Details
-
ArrayBuilder
public ArrayBuilder(int size) Creates a new builder.- Parameters:
size
- the exact array size
-
-
Method Details
-
unboxingClass
Gets the primitive type of a given class (when it exists).- Parameters:
parm
- a class- Returns:
- the primitive type or null it the argument is not unboxable
-
add
Description copied from interface:JexlArithmetic.ArrayBuilder
Adds a literal to the array.- Specified by:
add
in interfaceJexlArithmetic.ArrayBuilder
- Parameters:
value
- the item to add
-
create
Description copied from interface:JexlArithmetic.ArrayBuilder
Creates the actual "array" instance.- Specified by:
create
in interfaceJexlArithmetic.ArrayBuilder
- Parameters:
extended
- true when the last argument is ', ...'- Returns:
- the array
-