Class DynamicIndexedPropertyGetterByField

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

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

  • Method Details

    • determineField

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

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

      protected Object call(DynamicPropertyDescriptorByField descriptor, Object underlying)
      Description copied from class: DynamicPropertyGetterByFieldBase
      Call the getter to obtains the return result object, or null if no such field exists.
      Specified by:
      call in class DynamicPropertyGetterByFieldBase
      Parameters:
      descriptor - provides field 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 DynamicPropertyGetterByFieldBase
    • 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)
    • dynamicIndexPropertyDetermineField

      public static Field dynamicIndexPropertyDetermineField(Class clazz, String fieldName)
      NOTE: Code-generation-invoked method, method name and parameter order matters
      Parameters:
      clazz - class
      fieldName - field
      Returns:
      null or field
    • dynamicIndexedPropertyGet

      public static Object dynamicIndexedPropertyGet(DynamicPropertyDescriptorByField 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
    • dynamicIndexedPropertyExists

      public static boolean dynamicIndexedPropertyExists(DynamicPropertyDescriptorByField 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