Class DynamicIndexedPropertyGetterByMethod

java.lang.Object
com.espertech.esper.common.internal.event.bean.getter.DynamicPropertyGetterByMethodBase
com.espertech.esper.common.internal.event.bean.getter.DynamicIndexedPropertyGetterByMethod
All Implemented Interfaces:
EventPropertyGetter, EventPropertyValueGetter, BeanEventPropertyGetter, EventPropertyGetterSPI, EventPropertyValueGetterForge

public class DynamicIndexedPropertyGetterByMethod extends DynamicPropertyGetterByMethodBase
Getter for a dynamic indexed property (syntax field.indexed[0]?), using vanilla reflection.
  • Constructor Details

  • Method Details

    • determineMethod

      protected Method determineMethod(Class clazz)
      Description copied from class: DynamicPropertyGetterByMethodBase
      To be implemented to return the method required, or null to indicate an appropriate method could not be found.
      Specified by:
      determineMethod in class DynamicPropertyGetterByMethodBase
      Parameters:
      clazz - to search for a matching method
      Returns:
      method if found, or null if no matching method exists
    • determineMethodCodegen

      protected CodegenExpression determineMethodCodegen(CodegenExpressionRef clazz, CodegenMethodScope parent, CodegenClassScope codegenClassScope)
      Specified by:
      determineMethodCodegen in class DynamicPropertyGetterByMethodBase
    • call

      protected Object call(DynamicPropertyDescriptorByMethod descriptor, Object underlying)
      Description copied from class: DynamicPropertyGetterByMethodBase
      Call the getter to obtains the return result object, or null if no such method exists.
      Specified by:
      call in class DynamicPropertyGetterByMethodBase
      Parameters:
      descriptor - provides method information for the class
      underlying - is the underlying object to ask for the property value
      Returns:
      underlying
    • callCodegen

      protected CodegenExpression callCodegen(CodegenExpressionRef desc, CodegenExpressionRef object, CodegenMethodScope parent, CodegenClassScope codegenClassScope)
      Specified by:
      callCodegen in class DynamicPropertyGetterByMethodBase
    • isExistsProperty

      public boolean isExistsProperty(EventBean eventBean)
      Description copied from interface: EventPropertyGetter
      Returns true if the property exists, or false if the type does not have such a property.

      Useful for dynamic properties of the syntax "property?" and the dynamic nested/indexed/mapped versions. Dynamic nested properties follow the syntax "property?.nested" which is equivalent to "property?.nested?". If any of the properties in the path of a dynamic nested property return null, the dynamic nested property does not exists and the method returns false.

      For non-dynamic properties, this method always returns true since a getter would not be available unless

      Parameters:
      eventBean - is the event to check if the dynamic property exists
      Returns:
      indictor whether the property exists, always true for non-dynamic (default) properties
    • underlyingExistsCodegen

      public CodegenExpression underlyingExistsCodegen(CodegenExpression underlyingExpression, CodegenMethodScope parent, CodegenClassScope codegenClassScope)
    • dynamicIndexPropertyDetermineMethod

      public static Method dynamicIndexPropertyDetermineMethod(Class clazz, String getterMethodName)
      NOTE: Code-generation-invoked method, method name and parameter order matters
      Parameters:
      clazz - class
      getterMethodName - method
      Returns:
      null or method
    • dynamicIndexedPropertyGet

      public static Object dynamicIndexedPropertyGet(DynamicPropertyDescriptorByMethod descriptor, Object underlying, Object[] parameters, int index)
      NOTE: Code-generation-invoked method, method name and parameter order matters
      Parameters:
      descriptor - descriptor
      underlying - target
      parameters - params
      index - idx
      Returns:
      null or method
    • dynamicIndexedPropertyExists

      public static boolean dynamicIndexedPropertyExists(DynamicPropertyDescriptorByMethod descriptor, Object underlying, int index)
      NOTE: Code-generation-invoked method, method name and parameter order matters
      Parameters:
      descriptor - descriptor
      underlying - target
      index - idx
      Returns:
      null or method