Class DynamicPropertyGetterByMethodBase
java.lang.Object
com.espertech.esper.common.internal.event.bean.getter.DynamicPropertyGetterByMethodBase
- All Implemented Interfaces:
EventPropertyGetter
,EventPropertyValueGetter
,BeanEventPropertyGetter
,EventPropertyGetterSPI
,EventPropertyValueGetterForge
- Direct Known Subclasses:
DynamicIndexedPropertyGetterByMethod
,DynamicMappedPropertyGetterByMethod
,DynamicSimplePropertyGetterByMethod
public abstract class DynamicPropertyGetterByMethodBase
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<DynamicPropertyDescriptorByMethod>
protected final EventBeanTypedEventFactory
protected final CodegenFieldSharable
Fields inherited from interface com.espertech.esper.common.client.EventPropertyValueGetter
EPTYPE, EPTYPEARRAY
-
Constructor Summary
ConstructorDescriptionDynamicPropertyGetterByMethodBase
(EventBeanTypedEventFactory eventBeanTypedEventFactory, BeanEventTypeFactory beanEventTypeFactory) -
Method Summary
Modifier and TypeMethodDescriptionstatic Object
cacheAndCall
(CopyOnWriteArrayList<DynamicPropertyDescriptorByMethod> cache, DynamicPropertyGetterByMethodBase getter, Object object, EventBeanTypedEventFactory eventBeanTypedEventFactory, BeanEventTypeFactory beanEventTypeFactory) NOTE: Code-generation-invoked method, method name and parameter order mattersstatic boolean
cacheAndExists
(CopyOnWriteArrayList<DynamicPropertyDescriptorByMethod> cache, DynamicPropertyGetterByMethodBase 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
(DynamicPropertyDescriptorByMethod descriptor, Object underlying) Call the getter to obtains the return result object, or null if no such method exists.protected abstract CodegenExpression
callCodegen
(CodegenExpressionRef desc, CodegenExpressionRef object, CodegenMethodScope parent, CodegenClassScope codegenClassScope) protected abstract Method
determineMethod
(Class clazz) To be implemented to return the method required, or null to indicate an appropriate method could not be found.protected abstract CodegenExpression
determineMethodCodegen
(CodegenExpressionRef clazz, CodegenMethodScope parent, CodegenClassScope codegenClassScope) dynamicPropertyCacheAdd
(Class clazz, Method method, CopyOnWriteArrayList<DynamicPropertyDescriptorByMethod> cache) NOTE: Code-generation-invoked method, method name and parameter order mattersdynamicPropertyCacheCheck
(CopyOnWriteArrayList<DynamicPropertyDescriptorByMethod> cache, Object obj) NOTE: 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 DynamicPropertyDescriptorByMethod
getPopulateCache
(CopyOnWriteArrayList<DynamicPropertyDescriptorByMethod> cache, DynamicPropertyGetterByMethodBase dynamicPropertyGetterBase, Object obj, EventBeanTypedEventFactory eventBeanTypedEventFactory) protected CodegenExpression
getPopulateCacheCodegen
(CodegenExpression memberCache, CodegenExpressionRef object, CodegenMethodScope parent, CodegenClassScope codegenClassScope) static PropertyAccessException
handleException
(DynamicPropertyDescriptorByMethod 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
-
DynamicPropertyGetterByMethodBase
public DynamicPropertyGetterByMethodBase(EventBeanTypedEventFactory eventBeanTypedEventFactory, BeanEventTypeFactory beanEventTypeFactory)
-
-
Method Details
-
determineMethod
To be implemented to return the method required, or null to indicate an appropriate method could not be found.- Parameters:
clazz
- to search for a matching method- Returns:
- method if found, or null if no matching method exists
-
determineMethodCodegen
protected abstract CodegenExpression determineMethodCodegen(CodegenExpressionRef clazz, CodegenMethodScope parent, CodegenClassScope codegenClassScope) -
call
Call the getter to obtains the return result object, or null if no such method exists.- Parameters:
descriptor
- provides method 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<DynamicPropertyDescriptorByMethod> cache, DynamicPropertyGetterByMethodBase 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<DynamicPropertyDescriptorByMethod> cache, DynamicPropertyGetterByMethodBase 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 DynamicPropertyDescriptorByMethod getPopulateCache(CopyOnWriteArrayList<DynamicPropertyDescriptorByMethod> cache, DynamicPropertyGetterByMethodBase dynamicPropertyGetterBase, Object obj, EventBeanTypedEventFactory eventBeanTypedEventFactory) -
getPopulateCacheCodegen
protected CodegenExpression getPopulateCacheCodegen(CodegenExpression memberCache, CodegenExpressionRef object, CodegenMethodScope parent, CodegenClassScope codegenClassScope) -
dynamicPropertyCacheCheck
public static DynamicPropertyDescriptorByMethod dynamicPropertyCacheCheck(CopyOnWriteArrayList<DynamicPropertyDescriptorByMethod> cache, Object obj) NOTE: Code-generation-invoked method, method name and parameter order matters- Parameters:
obj
- targetcache
- cache- Returns:
- descriptor
-
dynamicPropertyCacheAdd
public static DynamicPropertyDescriptorByMethod dynamicPropertyCacheAdd(Class clazz, Method method, CopyOnWriteArrayList<DynamicPropertyDescriptorByMethod> cache) NOTE: Code-generation-invoked method, method name and parameter order matters- Parameters:
clazz
- classmethod
- methodcache
- cache- Returns:
- descriptor
-
handleException
public static PropertyAccessException handleException(DynamicPropertyDescriptorByMethod descriptor, Object underlying, Throwable t) NOTE: Code-generation-invoked method, method name and parameter order matters- Parameters:
descriptor
- descriptorunderlying
- underlyingt
- throwable- Returns:
- exception
-