Class RecordGetExecutor
- All Implemented Interfaces:
JexlPropertyGet
A record (JEP 395, Java 16+) exposes one accessor per component, named exactly like the
component - x(), not getX(). PropertyGetExecutor only looks for the bean
convention, so a record component was otherwise never resolved as a property.
Record detection and lookup are delegated to ClassTool, which resolves the relevant
methods through reflection so this module remains usable on the Java 8 baseline this project still
targets; on such a runtime, Class#isRecord() and Class#getRecordComponents() simply
do not exist and discovery quietly reports no match instead of failing to link.
- Since:
- 3.7.1
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.commons.jexl3.internal.introspection.AbstractExecutor
AbstractExecutor.Get, AbstractExecutor.Method, AbstractExecutor.Set -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Object[]A static signature for method().private final StringThe property (record component name).Fields inherited from class org.apache.commons.jexl3.internal.introspection.AbstractExecutor
method, objectClass, TRY_FAILED -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateRecordGetExecutor(Class<?> clazz, Method method, String identifier) Creates an instance. -
Method Summary
Modifier and TypeMethodDescriptionstatic RecordGetExecutordiscover(Introspector is, Class<?> clazz, String property) Discovers a RecordGetExecutor.Gets the property targeted by this executor.Method used to get the property value of an object.Attempts to reuse this JexlPropertyGet, checking that it is compatible with the actual set of arguments.Methods inherited from class org.apache.commons.jexl3.internal.introspection.AbstractExecutor
castInteger, castString, classOf, equals, equals, getMethod, getMethodName, getTargetClass, hashCode, initMarker, isAlive, isCacheable, makeArgs, tryFailedMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.commons.jexl3.introspection.JexlPropertyGet
isCacheable, isConstant, tryFailed
-
Field Details
-
EMPTY_PARAMS
A static signature for method(). -
property
The property (record component name).
-
-
Constructor Details
-
RecordGetExecutor
Creates an instance.- Parameters:
clazz- the class the accessor applies tomethod- the accessor method held by this executoridentifier- the property to get
-
-
Method Details
-
discover
Discovers a RecordGetExecutor.The class must be a record and declare a component named
property; the accessor method itself is resolved throughisso it goes through the same permission checks as every other property accessor.- Parameters:
is- the introspectorclazz- the class to find the accessor method fromproperty- the property (record component) name to find- Returns:
- the executor if found, null otherwise
-
getTargetProperty
Description copied from class:AbstractExecutorGets the property targeted by this executor.- Overrides:
getTargetPropertyin classAbstractExecutor- Returns:
- The target property
-
invoke
Description copied from interface:JexlPropertyGetMethod used to get the property value of an object.- Parameters:
o- The object to get the property value from.- Returns:
- The property value.
- Throws:
IllegalAccessExceptionInvocationTargetException
-
tryInvoke
Description copied from interface:JexlPropertyGetAttempts to reuse this JexlPropertyGet, checking that it is compatible with the actual set of arguments.- Parameters:
o- The object to invoke the property get uponidentifier- The property key to get- Returns:
- The result of the method invocation that should be checked by tryFailed to determine if it succeeded or failed.
-