Class DynamicPropertyGetterByFieldBase
java.lang.Object
com.espertech.esper.common.internal.event.bean.getter.DynamicPropertyGetterByFieldBase
- All Implemented Interfaces:
EventPropertyGetter
,EventPropertyValueGetter
,BeanEventPropertyGetter
,EventPropertyGetterSPI
,EventPropertyValueGetterForge
- Direct Known Subclasses:
DynamicIndexedPropertyGetterByField
,DynamicMappedPropertyGetterByField
,DynamicSimplePropertyGetterByField
public abstract class DynamicPropertyGetterByFieldBase
extends Object
implements BeanEventPropertyGetter
Base class for getters for a dynamic property (syntax field.inner?), caches methods to use for classes.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final BeanEventTypeFactory
protected final CopyOnWriteArrayList<DynamicPropertyDescriptorByField>
protected final EventBeanTypedEventFactory
protected final CodegenFieldSharable
Fields inherited from interface com.espertech.esper.common.client.EventPropertyValueGetter
EPTYPE, EPTYPEARRAY
-
Constructor Summary
ConstructorDescriptionDynamicPropertyGetterByFieldBase
(EventBeanTypedEventFactory eventBeanTypedEventFactory, BeanEventTypeFactory beanEventTypeFactory) -
Method Summary
Modifier and TypeMethodDescriptionstatic Object
cacheAndCall
(CopyOnWriteArrayList<DynamicPropertyDescriptorByField> cache, DynamicPropertyGetterByFieldBase getter, Object object, EventBeanTypedEventFactory eventBeanTypedEventFactory, BeanEventTypeFactory beanEventTypeFactory) NOTE: Code-generation-invoked method, method name and parameter order mattersstatic boolean
cacheAndExists
(CopyOnWriteArrayList<DynamicPropertyDescriptorByField> cache, DynamicPropertyGetterByFieldBase getter, Object object, EventBeanTypedEventFactory eventBeanTypedEventFactory) NOTE: Code-generation-invoked method, method name and parameter order mattersprotected CodegenExpression
cacheAndExistsCodegen
(CodegenExpression underlyingExpression, CodegenMethodScope parent, CodegenClassScope codegenClassScope) protected abstract Object
call
(DynamicPropertyDescriptorByField descriptor, Object underlying) Call the getter to obtains the return result object, or null if no such field exists.protected abstract CodegenExpression
callCodegen
(CodegenExpressionRef desc, CodegenExpressionRef object, CodegenMethodScope parent, CodegenClassScope codegenClassScope) protected abstract Field
determineField
(Class clazz) To be implemented to return the field required, or null to indicate an appropriate field could not be found.protected abstract CodegenExpression
determineFieldCodegen
(CodegenExpressionRef clazz, CodegenMethodScope parent, CodegenClassScope codegenClassScope) dynamicPropertyCacheAdd
(Class clazz, Field field, CopyOnWriteArrayList<DynamicPropertyDescriptorByField> cache) NOTE: Code-generation-invoked method, method name and parameter order mattersNOTE: Code-generation-invoked method, method name and parameter order matterseventBeanExistsCodegen
(CodegenExpression beanExpression, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) eventBeanFragmentCodegen
(CodegenExpression beanExpression, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) eventBeanGetCodegen
(CodegenExpression beanExpression, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) final Object
Return the value for the property in the event object specified when the instance was obtained.getBeanProp
(Object object) Returns the property as an object.getFragment
(EventBean eventBean) protected static DynamicPropertyDescriptorByField
getPopulateCache
(CopyOnWriteArrayList<DynamicPropertyDescriptorByField> cache, DynamicPropertyGetterByFieldBase dynamicPropertyGetterBase, Object obj, EventBeanTypedEventFactory eventBeanTypedEventFactory) protected CodegenExpression
getPopulateCacheCodegen
(CodegenExpression memberCache, CodegenExpressionRef object, CodegenMethodScope parent, CodegenClassScope codegenClassScope) static PropertyAccessException
handleException
(DynamicPropertyDescriptorByField descriptor, Object underlying, Throwable t) NOTE: Code-generation-invoked method, method name and parameter order mattersboolean
isBeanExistsProperty
(Object object) Returns true if the dynamic property exists.underlyingFragmentCodegen
(CodegenExpression underlyingExpression, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) underlyingGetCodegen
(CodegenExpression underlyingExpression, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.espertech.esper.common.client.EventPropertyGetter
isExistsProperty
Methods inherited from interface com.espertech.esper.common.internal.event.core.EventPropertyGetterSPI
underlyingExistsCodegen
-
Field Details
-
eventBeanTypedEventFactory
-
beanEventTypeFactory
-
cache
-
sharableCode
-
-
Constructor Details
-
DynamicPropertyGetterByFieldBase
public DynamicPropertyGetterByFieldBase(EventBeanTypedEventFactory eventBeanTypedEventFactory, BeanEventTypeFactory beanEventTypeFactory)
-
-
Method Details
-
determineField
To be implemented to return the field required, or null to indicate an appropriate field could not be found.- Parameters:
clazz
- to search for a matching field- Returns:
- field if found, or null if no matching field exists
-
determineFieldCodegen
protected abstract CodegenExpression determineFieldCodegen(CodegenExpressionRef clazz, CodegenMethodScope parent, CodegenClassScope codegenClassScope) -
call
Call the getter to obtains the return result object, or null if no such field exists.- Parameters:
descriptor
- provides field information for the classunderlying
- is the underlying object to ask for the property value- Returns:
- underlying
-
callCodegen
protected abstract CodegenExpression callCodegen(CodegenExpressionRef desc, CodegenExpressionRef object, CodegenMethodScope parent, CodegenClassScope codegenClassScope) -
cacheAndCall
public static Object cacheAndCall(CopyOnWriteArrayList<DynamicPropertyDescriptorByField> cache, DynamicPropertyGetterByFieldBase getter, Object object, EventBeanTypedEventFactory eventBeanTypedEventFactory, BeanEventTypeFactory beanEventTypeFactory) NOTE: Code-generation-invoked method, method name and parameter order matters- Parameters:
cache
- cachegetter
- getterobject
- objecteventBeanTypedEventFactory
- event serverbeanEventTypeFactory
- bean factory- Returns:
- property
-
cacheAndExists
public static boolean cacheAndExists(CopyOnWriteArrayList<DynamicPropertyDescriptorByField> cache, DynamicPropertyGetterByFieldBase getter, Object object, EventBeanTypedEventFactory eventBeanTypedEventFactory) NOTE: Code-generation-invoked method, method name and parameter order matters- Parameters:
cache
- cachegetter
- getterobject
- objecteventBeanTypedEventFactory
- event server- Returns:
- exists-flag
-
cacheAndExistsCodegen
protected CodegenExpression cacheAndExistsCodegen(CodegenExpression underlyingExpression, CodegenMethodScope parent, CodegenClassScope codegenClassScope) -
getBeanProp
Description copied from interface:BeanEventPropertyGetter
Returns the property as an object.- Specified by:
getBeanProp
in interfaceBeanEventPropertyGetter
- Parameters:
object
- to evaluate- Returns:
- property of object
- Throws:
PropertyAccessException
- if access failed
-
getTargetType
- Specified by:
getTargetType
in interfaceBeanEventPropertyGetter
-
isBeanExistsProperty
Description copied from interface:BeanEventPropertyGetter
Returns true if the dynamic property exists.- Specified by:
isBeanExistsProperty
in interfaceBeanEventPropertyGetter
- Parameters:
object
- to evaluate- Returns:
- indicator if property exists
-
get
Description copied from interface:EventPropertyValueGetter
Return the value for the property in the event object specified when the instance was obtained. Useful for fast access to event properties. Throws a PropertyAccessException if the getter instance doesn't match the EventType it was obtained from, and to indicate other property access problems.- Specified by:
get
in interfaceEventPropertyValueGetter
- Parameters:
event
- is the event to get the value of a property from- Returns:
- value of property in event
- Throws:
PropertyAccessException
- to indicate that property access failed
-
getBeanPropType
- Specified by:
getBeanPropType
in interfaceBeanEventPropertyGetter
-
eventBeanGetCodegen
public CodegenExpression eventBeanGetCodegen(CodegenExpression beanExpression, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) - Specified by:
eventBeanGetCodegen
in interfaceEventPropertyValueGetterForge
-
eventBeanExistsCodegen
public CodegenExpression eventBeanExistsCodegen(CodegenExpression beanExpression, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) - Specified by:
eventBeanExistsCodegen
in interfaceEventPropertyGetterSPI
-
eventBeanFragmentCodegen
public CodegenExpression eventBeanFragmentCodegen(CodegenExpression beanExpression, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) - Specified by:
eventBeanFragmentCodegen
in interfaceEventPropertyGetterSPI
-
underlyingGetCodegen
public CodegenExpression underlyingGetCodegen(CodegenExpression underlyingExpression, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) - Specified by:
underlyingGetCodegen
in interfaceEventPropertyGetterSPI
-
underlyingFragmentCodegen
public CodegenExpression underlyingFragmentCodegen(CodegenExpression underlyingExpression, CodegenMethodScope codegenMethodScope, CodegenClassScope codegenClassScope) - Specified by:
underlyingFragmentCodegen
in interfaceEventPropertyGetterSPI
-
getFragment
Description copied from interface:EventPropertyGetter
ReturnsEventBean
or array ofEventBean
for a property name or property expression.For use with properties whose value is itself an event or whose value can be represented as an event by the underlying event representation.
The
EventType
of theEventBean
instance(s) returned by this method can be determined byEventType.getFragmentType(String)
. UseEventPropertyDescriptor
to obtain a list of properties that return fragments from an event type.Returns null if the property value is null or the property value cannot be represented as a fragment by the underlying representation.
- Specified by:
getFragment
in interfaceEventPropertyGetter
- Parameters:
eventBean
- is the event to get the fragment value of a property- Returns:
- the value of a property as an EventBean or array of EventBean
-
getPopulateCache
protected static DynamicPropertyDescriptorByField getPopulateCache(CopyOnWriteArrayList<DynamicPropertyDescriptorByField> cache, DynamicPropertyGetterByFieldBase dynamicPropertyGetterBase, Object obj, EventBeanTypedEventFactory eventBeanTypedEventFactory) -
getPopulateCacheCodegen
protected CodegenExpression getPopulateCacheCodegen(CodegenExpression memberCache, CodegenExpressionRef object, CodegenMethodScope parent, CodegenClassScope codegenClassScope) -
dynamicPropertyCacheCheck
public static DynamicPropertyDescriptorByField dynamicPropertyCacheCheck(CopyOnWriteArrayList<DynamicPropertyDescriptorByField> cache, Object obj) NOTE: Code-generation-invoked method, method name and parameter order matters- Parameters:
obj
- targetcache
- cache- Returns:
- descriptor
-
dynamicPropertyCacheAdd
public static DynamicPropertyDescriptorByField dynamicPropertyCacheAdd(Class clazz, Field field, CopyOnWriteArrayList<DynamicPropertyDescriptorByField> cache) NOTE: Code-generation-invoked method, method name and parameter order matters- Parameters:
clazz
- classfield
- fieldcache
- cache- Returns:
- descriptor
-
handleException
public static PropertyAccessException handleException(DynamicPropertyDescriptorByField descriptor, Object underlying, Throwable t) NOTE: Code-generation-invoked method, method name and parameter order matters- Parameters:
descriptor
- descriptorunderlying
- underlyingt
- throwable- Returns:
- exception
-