Class DynamicMappedPropertyGetterByField
java.lang.Object
com.espertech.esper.common.internal.event.bean.getter.DynamicPropertyGetterByFieldBase
com.espertech.esper.common.internal.event.bean.getter.DynamicMappedPropertyGetterByField
- All Implemented Interfaces:
EventPropertyGetter
,EventPropertyValueGetter
,BeanEventPropertyGetter
,EventPropertyGetterSPI
,EventPropertyValueGetterForge
Getter for a dynamic mapped property (syntax field.mapped('key')?), using vanilla reflection.
-
Field Summary
Fields inherited from class com.espertech.esper.common.internal.event.bean.getter.DynamicPropertyGetterByFieldBase
beanEventTypeFactory, cache, eventBeanTypedEventFactory, sharableCode
Fields inherited from interface com.espertech.esper.common.client.EventPropertyValueGetter
EPTYPE, EPTYPEARRAY
-
Constructor Summary
ConstructorDescriptionDynamicMappedPropertyGetterByField
(String fieldName, String key, EventBeanTypedEventFactory eventBeanTypedEventFactory, BeanEventTypeFactory beanEventTypeFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected Object
call
(DynamicPropertyDescriptorByField descriptor, Object underlying) Call the getter to obtains the return result object, or null if no such field exists.protected CodegenExpression
callCodegen
(CodegenExpressionRef desc, CodegenExpressionRef object, CodegenMethodScope parent, CodegenClassScope codegenClassScope) protected Field
determineField
(Class clazz) To be implemented to return the field required, or null to indicate an appropriate field could not be found.protected CodegenExpression
determineFieldCodegen
(CodegenExpressionRef clazz, CodegenMethodScope parent, CodegenClassScope codegenClassScope) static boolean
dynamicMappedPropertyExists
(DynamicPropertyDescriptorByField descriptor, Object underlying, String key) NOTE: Code-generation-invoked method, method name and parameter order mattersstatic Object
dynamicMappedPropertyGet
(DynamicPropertyDescriptorByField descriptor, Object underlying, String key) NOTE: Code-generation-invoked method, method name and parameter order mattersstatic Field
dynamicMapperPropertyDetermineField
(Class clazz, String fieldName) NOTE: Code-generation-invoked method, method name and parameter order mattersboolean
isExistsProperty
(EventBean eventBean) Returns true if the property exists, or false if the type does not have such a property.underlyingExistsCodegen
(CodegenExpression underlyingExpression, CodegenMethodScope parent, CodegenClassScope codegenClassScope) Methods inherited from class com.espertech.esper.common.internal.event.bean.getter.DynamicPropertyGetterByFieldBase
cacheAndCall, cacheAndExists, cacheAndExistsCodegen, dynamicPropertyCacheAdd, dynamicPropertyCacheCheck, eventBeanExistsCodegen, eventBeanFragmentCodegen, eventBeanGetCodegen, get, getBeanProp, getBeanPropType, getFragment, getPopulateCache, getPopulateCacheCodegen, getTargetType, handleException, isBeanExistsProperty, underlyingFragmentCodegen, underlyingGetCodegen
-
Constructor Details
-
DynamicMappedPropertyGetterByField
public DynamicMappedPropertyGetterByField(String fieldName, String key, EventBeanTypedEventFactory eventBeanTypedEventFactory, BeanEventTypeFactory beanEventTypeFactory)
-
-
Method Details
-
determineField
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 classDynamicPropertyGetterByFieldBase
- 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 classDynamicPropertyGetterByFieldBase
-
call
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 classDynamicPropertyGetterByFieldBase
- Parameters:
descriptor
- provides field information for the classunderlying
- 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 classDynamicPropertyGetterByFieldBase
-
underlyingExistsCodegen
public CodegenExpression underlyingExistsCodegen(CodegenExpression underlyingExpression, CodegenMethodScope parent, CodegenClassScope codegenClassScope) -
isExistsProperty
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
-
dynamicMapperPropertyDetermineField
public static Field dynamicMapperPropertyDetermineField(Class clazz, String fieldName) throws PropertyAccessException NOTE: Code-generation-invoked method, method name and parameter order matters- Parameters:
clazz
- classfieldName
- method- Returns:
- value
- Throws:
PropertyAccessException
- for access ex
-
dynamicMappedPropertyGet
public static Object dynamicMappedPropertyGet(DynamicPropertyDescriptorByField descriptor, Object underlying, String key) NOTE: Code-generation-invoked method, method name and parameter order matters- Parameters:
descriptor
- descriptorunderlying
- targetkey
- key- Returns:
- value
-
dynamicMappedPropertyExists
public static boolean dynamicMappedPropertyExists(DynamicPropertyDescriptorByField descriptor, Object underlying, String key) NOTE: Code-generation-invoked method, method name and parameter order matters- Parameters:
descriptor
- descriptorunderlying
- targetkey
- key- Returns:
- value
-