Class PropertyGetExecutor

All Implemented Interfaces:
JexlPropertyGet

public final class PropertyGetExecutor extends AbstractExecutor.Get
Specialized executor to get a property from an object.
Since:
2.0
  • Field Details

    • EMPTY_PARAMS

      private static final Object[] EMPTY_PARAMS
      A static signature for method().
    • property

      private final String property
      The property.
  • Constructor Details

    • PropertyGetExecutor

      private PropertyGetExecutor(Class<?> clazz, Method method, String identifier)
      Creates an instance.
      Parameters:
      clazz - he class the get method applies to
      method - the method held by this executor
      identifier - the property to get
  • Method Details

    • discover

      public static PropertyGetExecutor discover(Introspector is, Class<?> clazz, String property)
      Discovers a PropertyGetExecutor.

      The method to be found should be named "get{P,p}property.

      Parameters:
      is - the introspector
      clazz - the class to find the get method from
      property - the property name to find
      Returns:
      the executor if found, null otherwise
    • discoverGet

      static Method discoverGet(Introspector is, String which, Class<?> clazz, String property)
      Base method for boolean and object property get.
      Parameters:
      is - the introspector
      which - "is" or "get" for boolean or object
      clazz - The class being examined.
      property - The property being addressed.
      Returns:
      The {get,is}{p,P}roperty method if one exists, null otherwise.
    • getTargetProperty

      public Object getTargetProperty()
      Description copied from class: AbstractExecutor
      Gets the property targeted by this executor.
      Overrides:
      getTargetProperty in class AbstractExecutor
      Returns:
      the target property
    • invoke

      Description copied from interface: JexlPropertyGet
      Method used to get the property value of an object.
      Parameters:
      o - the object to get the property value from.
      Returns:
      the property value.
      Throws:
      IllegalAccessException
      InvocationTargetException
    • tryInvoke

      public Object tryInvoke(Object o, Object identifier)
      Description copied from interface: JexlPropertyGet
      Attempts to reuse this JexlPropertyGet, checking that it is compatible with the actual set of arguments.
      Parameters:
      o - the object to invoke the property get upon
      identifier - 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.