Class ELArray
java.lang.Object
io.micronaut.el.runtime.ELArray
Direct operations on Java arrays.
The Jakarta EL array resolver uses java.lang.reflect.Array for all array element access. These
operations are kept in typed branches so interpreted expressions do not pay that reflective invocation cost.
- Since:
- 1.1
- Author:
- Denis Stepanov
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable ObjectReads an array element using a typed JVM array operation.static booleanReturns whether the value is a Java array.static intReturns the array length, or-1when the value is not an array.static ObjectnewInstance(Class<?> componentType, int length) Creates an array of the given component type, withoutjava.lang.reflect.Array.static voidWrites an array element using a typed JVM array operation.
-
Method Details
-
isArray
Returns whether the value is a Java array.- Parameters:
value- The value- Returns:
- Whether the value is a Java array
-
length
Returns the array length, or-1when the value is not an array.- Parameters:
value- The value- Returns:
- The array length, or
-1when the value is not an array
-
newInstance
Creates an array of the given component type, withoutjava.lang.reflect.Array.A primitive component type reaches the JVM array creation of that type directly. A reference one goes through
Arrays.copyOf(Object[], int, Class), which builds the array of the requested type and leaves its elements null.- Parameters:
componentType- The component typelength- The length- Returns:
- The array
-
get
-
set
Writes an array element using a typed JVM array operation.The primitive branches accept the same widening primitive conversions as
Arraywhile reference arrays retain the JVM array-store check.- Parameters:
array- The arrayindex- The indexvalue- The value
-