List of usage examples for java.lang.reflect Method getDeclaringClass
@Override
public Class<?> getDeclaringClass()
From source file:com.bstek.dorado.idesupport.initializer.CommonRuleTemplateInitializer.java
protected Collection<AutoPropertyTemplate> getProperties(Class<?> type, XmlNodeInfo xmlNodeInfo, InitializerContext initializerContext) throws Exception { HashMap<String, AutoPropertyTemplate> properties = new LinkedHashMap<String, AutoPropertyTemplate>(); RuleTemplateManager ruleTemplateManager = initializerContext.getRuleTemplateManager(); if (xmlNodeInfo != null) { if (xmlNodeInfo.isInheritable()) { AutoPropertyTemplate propertyTemplate = new AutoPropertyTemplate("impl"); propertyTemplate.setPrimitive(true); properties.put(propertyTemplate.getName(), propertyTemplate); propertyTemplate = new AutoPropertyTemplate("parent"); propertyTemplate.setPrimitive(true); properties.put(propertyTemplate.getName(), propertyTemplate); }//from w ww . j a v a 2 s. co m if (xmlNodeInfo.isScopable()) { AutoPropertyTemplate propertyTemplate = new AutoPropertyTemplate("scope"); propertyTemplate.setPrimitive(true); Object[] ecs = Scope.class.getEnumConstants(); String[] enumValues = new String[ecs.length]; for (int i = 0; i < ecs.length; i++) { enumValues[i] = ecs[i].toString(); } propertyTemplate.setEnumValues(enumValues); properties.put(propertyTemplate.getName(), propertyTemplate); } if (StringUtils.isNotEmpty(xmlNodeInfo.getDefinitionType())) { Class<?> definitionType = ClassUtils.forName(xmlNodeInfo.getDefinitionType()); if (ListenableObjectDefinition.class.isAssignableFrom(definitionType)) { AutoPropertyTemplate propertyTemplate = new AutoPropertyTemplate("listener"); propertyTemplate.setPrimitive(true); properties.put(propertyTemplate.getName(), propertyTemplate); } if (InterceptableDefinition.class.isAssignableFrom(definitionType)) { AutoPropertyTemplate propertyTemplate = new AutoPropertyTemplate("interceptor"); propertyTemplate.setPrimitive(true); properties.put(propertyTemplate.getName(), propertyTemplate); } } for (Map.Entry<String, String> entry : xmlNodeInfo.getFixedProperties().entrySet()) { String propertyName = entry.getKey(); String value = entry.getValue(); AutoPropertyTemplate propertyTemplate = new AutoPropertyTemplate(propertyName); propertyTemplate.setDefaultValue(value); propertyTemplate.setPrimitive(true); propertyTemplate.setFixed(true); propertyTemplate.setVisible(false); properties.put(propertyName, propertyTemplate); } for (Map.Entry<String, XmlProperty> entry : xmlNodeInfo.getProperties().entrySet()) { String propertyName = entry.getKey(); XmlProperty xmlProperty = entry.getValue(); TypeInfo propertyTypeInfo = TypeInfo.parse(xmlProperty.propertyType()); Class<?> propertyType = null; if (propertyTypeInfo != null) { propertyType = propertyTypeInfo.getType(); } AutoPropertyTemplate propertyTemplate = new AutoPropertyTemplate(propertyName, xmlProperty); propertyTemplate.setPrimitive(xmlProperty.attributeOnly()); if (propertyType != null && !propertyType.equals(String.class)) { propertyTemplate.setType(propertyType.getName()); } if (xmlProperty.composite()) { initCompositeProperty(propertyTemplate, propertyType, initializerContext); } propertyTemplate.setDeprecated(xmlProperty.deprecated()); properties.put(propertyName, propertyTemplate); } } PropertyDescriptor[] propertyDescriptors = PropertyUtils.getPropertyDescriptors(type); for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { Method readMethod = propertyDescriptor.getReadMethod(); if (readMethod != null && propertyDescriptor.getWriteMethod() != null) { if (readMethod.getDeclaringClass() != type) { try { readMethod = type.getDeclaredMethod(readMethod.getName(), readMethod.getParameterTypes()); } catch (NoSuchMethodException e) { continue; } } String propertyName = propertyDescriptor.getName(); XmlSubNode xmlSubNode = readMethod.getAnnotation(XmlSubNode.class); if (xmlSubNode != null) { continue; } TypeInfo propertyTypeInfo; Class<?> propertyType = propertyDescriptor.getPropertyType(); if (Collection.class.isAssignableFrom(propertyType)) { propertyTypeInfo = TypeInfo.parse((ParameterizedType) readMethod.getGenericReturnType(), true); propertyType = propertyTypeInfo.getType(); } else { propertyTypeInfo = new TypeInfo(propertyType, false); } AutoPropertyTemplate propertyTemplate = null; XmlProperty xmlProperty = readMethod.getAnnotation(XmlProperty.class); if (xmlProperty != null) { if (xmlProperty.unsupported()) { continue; } propertyTemplate = properties.get(propertyName); if (propertyTemplate == null) { propertyTemplate = new AutoPropertyTemplate(propertyName, readMethod, xmlProperty); propertyTemplate.setPrimitive(xmlProperty.attributeOnly()); } if (("dataSet".equals(propertyName) || "dataPath".equals(propertyName) || "property".equals(propertyName)) && DataControl.class.isAssignableFrom(type)) { propertyTemplate.setHighlight(1); } if (xmlProperty.composite()) { initCompositeProperty(propertyTemplate, propertyType, initializerContext); } int clientTypes = ClientType.parseClientTypes(xmlProperty.clientTypes()); if (clientTypes > 0) { propertyTemplate.setClientTypes(clientTypes); } propertyTemplate.setDeprecated(xmlProperty.deprecated()); } else if (EntityUtils.isSimpleType(propertyType) || propertyType.equals(Class.class) || propertyType.isArray() && propertyType.getComponentType().equals(String.class)) { propertyTemplate = new AutoPropertyTemplate(propertyName, readMethod, xmlProperty); } if (propertyTemplate != null) { propertyTemplate.setType(propertyDescriptor.getPropertyType().getName()); if (propertyType.isEnum()) { Object[] ecs = propertyType.getEnumConstants(); String[] enumValues = new String[ecs.length]; for (int i = 0; i < ecs.length; i++) { enumValues[i] = ecs[i].toString(); } propertyTemplate.setEnumValues(enumValues); } ComponentReference componentReference = readMethod.getAnnotation(ComponentReference.class); if (componentReference != null) { ReferenceTemplate referenceTemplate = new LazyReferenceTemplate(ruleTemplateManager, componentReference.value(), "id"); propertyTemplate.setReference(referenceTemplate); } IdeProperty ideProperty = readMethod.getAnnotation(IdeProperty.class); if (ideProperty != null) { propertyTemplate.setVisible(ideProperty.visible()); propertyTemplate.setEditor(ideProperty.editor()); propertyTemplate.setHighlight(ideProperty.highlight()); if (StringUtils.isNotEmpty(ideProperty.enumValues())) { propertyTemplate.setEnumValues(StringUtils.split(ideProperty.enumValues(), ",;")); } } ClientProperty clientProperty = readMethod.getAnnotation(ClientProperty.class); if (clientProperty != null) { propertyTemplate.setDefaultValue(clientProperty.escapeValue()); } properties.put(propertyName, propertyTemplate); } } } return properties.values(); }
From source file:com.google.api.server.spi.config.jsonwriter.JsonConfigWriter.java
private void convertComplexParameter(ApiParameterConfig config, Method method, ObjectNode descriptorSchemasNode, ObjectNode descriptorMethodNode, ApiConfig apiConfig, List<ApiParameterConfig> parameterConfigs) throws ApiConfigException { TypeToken<?> type = config.getSchemaBaseType(); ObjectNode requestTypeNode = objectMapper.createObjectNode(); addTypeToNode(descriptorSchemasNode, type, null, requestTypeNode, apiConfig, parameterConfigs); setNodePropertyNoConflict(descriptorMethodNode, "request", requestTypeNode, "Method " + method.getDeclaringClass().getName() + "." + method.getName() + " cannot have multiple resource parameters"); }
From source file:com.mystudy.source.spring.aop.JdkDynamicAopProxy.java
/** * /* ww w .ja v a 2 s .c om*/ */ public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { MethodInvocation invocation; Object oldProxy = null; boolean setProxyContext = false; TargetSource targetSource = this.advised.targetSource; Class<?> targetClass = null; Object target = null; try {//eqal if (!this.equalsDefined && AopUtils.isEqualsMethod(method)) { // The target does not implement the equals(Object) method itself. return equals(args[0]); } //hashcode if (!this.hashCodeDefined && AopUtils.isHashCodeMethod(method)) { // The target does not implement the hashCode() method itself. return hashCode(); } if (!this.advised.opaque && method.getDeclaringClass().isInterface() && method.getDeclaringClass().isAssignableFrom(Advised.class)) { // Service invocations on ProxyConfig with the proxy config... return AopUtils.invokeJoinpointUsingReflection(this.advised, method, args); } Object retVal; if (this.advised.exposeProxy) { // Make invocation available if necessary. oldProxy = AopContext.setCurrentProxy(proxy); setProxyContext = true; } // May be null. Get as late as possible to minimize the time we "own" the target, // in case it comes from a pool. target = targetSource.getTarget(); if (target != null) { targetClass = target.getClass(); } // Get the interception chain for this method. List<Object> chain = this.advised.getInterceptorsAndDynamicInterceptionAdvice(method, targetClass); // Check whether we have any advice. If we don't, we can fallback on direct // reflective invocation of the target, and avoid creating a MethodInvocation. if (chain.isEmpty()) { // We can skip creating a MethodInvocation: just invoke the target directly // Note that the final invoker must be an InvokerInterceptor so we know it does // nothing but a reflective operation on the target, and no hot swapping or fancy proxying. retVal = AopUtils.invokeJoinpointUsingReflection(target, method, args); } else { //chain???? // We need to create a method invocation... invocation = new ReflectiveMethodInvocation(proxy, target, method, args, targetClass, chain); // Proceed to the joinpoint through the interceptor chain. retVal = invocation.proceed(); } // Massage return value if necessary. Class<?> returnType = method.getReturnType(); if (retVal != null && retVal == target && returnType.isInstance(proxy) && !RawTargetAccess.class.isAssignableFrom(method.getDeclaringClass())) { // Special case: it returned "this" and the return type of the method // is type-compatible. Note that we can't help if the target sets // a reference to itself in another returned object. retVal = proxy; } else if (retVal == null && returnType != Void.TYPE && returnType.isPrimitive()) { throw new AopInvocationException( "Null return value from advice does not match primitive return type for: " + method); } return retVal; } finally { if (target != null && !targetSource.isStatic()) { // Must have come from TargetSource. targetSource.releaseTarget(target); } if (setProxyContext) { // Restore old proxy. AopContext.setCurrentProxy(oldProxy); } } }
From source file:de.matzefratze123.heavyspleef.core.flag.FlagRegistry.java
public void flushAndExecuteInitMethods() { while (!queuedInitMethods.isEmpty()) { Method method = queuedInitMethods.poll(); boolean accessible = method.isAccessible(); if (!accessible) { method.setAccessible(true);/* www.j a v a 2 s .c o m*/ } Class<?>[] parameters = method.getParameterTypes(); Object[] args = new Object[parameters.length]; for (int i = 0; i < parameters.length; i++) { Class<?> parameter = parameters[i]; if (parameter == HeavySpleef.class) { args[i] = heavySpleef; } } try { method.invoke(null, args); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { throw new IllegalArgumentException("Could not invoke flag initialization method " + method.getName() + " of type " + method.getDeclaringClass().getCanonicalName() + ": ", e); } finally { method.setAccessible(accessible); } } }
From source file:org.alfresco.repo.lotus.ws.impl.auth.ChainingAuthProxyFactory.java
/** * Instantiates a new chaining subsystem proxy factory. *///from ww w . j av a 2s .c o m public ChainingAuthProxyFactory() { addAdvisor(new DefaultPointcutAdvisor(new MethodInterceptor() { public Object invoke(MethodInvocation mi) throws Throwable { Method method = mi.getMethod(); boolean authenticated = false; try { for (String sourceBeanName : sourceBeanNames) { try { Object bean = beanFactory.getBean(sourceBeanName); // Ignore inactive beans if ((bean instanceof Authenticator) && ((Authenticator) bean).isActive()) { authenticated = (Boolean) method.invoke(bean, mi.getArguments()); if (authenticated) { return authenticated; } } } catch (BeansException e) { // Ignore and continue } } // Fall back to the default object if we have one if (!authenticated && defaultTarget != null && method.getDeclaringClass().isAssignableFrom(defaultTarget.getClass())) { return method.invoke(defaultTarget, mi.getArguments()); } // If this is the isActive() method, we can handle it ourselves! if (method.equals(Authenticator.class.getMethod("isActive"))) { return Boolean.FALSE; } // Otherwise, something has gone wrong with wiring! throw new RuntimeException("Don't know where to route call to method " + method); } catch (InvocationTargetException e) { // Unwrap invocation target exceptions throw e.getTargetException(); } } })); }
From source file:com.bstek.dorado.config.xml.XmlParserHelper.java
protected void doInitObjectParser(Context context, ObjectParser objectParser, XmlNodeInfo xmlNodeInfo, Class<?> beanType) throws Exception { objectParser.setAnnotationOwnerType(beanType); if (!Modifier.isAbstract(beanType.getModifiers())) { objectParser.setImpl(beanType.getName()); }//ww w . java 2s . com if (xmlNodeInfo != null) { if (StringUtils.isNotEmpty(xmlNodeInfo.getDefinitionType())) { objectParser.setDefinitionType(xmlNodeInfo.getDefinitionType()); } Map<String, XmlParser> propertyParsers = objectParser.getPropertyParsers(); Map<String, XmlParser> subParsers = objectParser.getSubParsers(); if (!(objectParser instanceof CompositePropertyParser)) { boolean inheritable = objectParser.isInheritable() || xmlNodeInfo.isInheritable(); objectParser.setInheritable(inheritable); if (inheritable) { if (propertyParsers.get("parent") == null) { objectParser.registerPropertyParser("parent", beanFactory.getBean(IGNORE_PARSER, XmlParser.class)); } } boolean scopable = objectParser.isScopable() || xmlNodeInfo.isScopable(); objectParser.setScopable(scopable); if (scopable) { if (propertyParsers.get("scope") == null) { objectParser.registerPropertyParser("scope", beanFactory.getBean(IGNORE_PARSER, XmlParser.class)); } } for (String fixedProperty : xmlNodeInfo.getFixedProperties().keySet()) { if (propertyParsers.get(fixedProperty) == null) { objectParser.registerPropertyParser(fixedProperty, beanFactory.getBean(IGNORE_PARSER, XmlParser.class)); } } } for (XmlSubNode xmlSubNode : xmlNodeInfo.getSubNodes()) { if (StringUtils.isNotEmpty(xmlSubNode.propertyType())) { List<XmlParserInfo> xmlParserInfos = getSubNodeXmlParserInfos(context, beanType, xmlSubNode.propertyName(), null, xmlSubNode); if (xmlParserInfos != null) { for (XmlParserInfo xmlParserInfo : xmlParserInfos) { objectParser.registerSubParser(xmlParserInfo.getPath(), xmlParserInfo.getParser()); } } } else if (StringUtils.isNotEmpty(xmlSubNode.nodeName()) && StringUtils.isNotEmpty(xmlSubNode.parser())) { BeanWrapper beanWrapper = BeanFactoryUtils.getBean(xmlSubNode.parser(), Scope.instant); objectParser.registerSubParser(xmlSubNode.nodeName(), (XmlParser) beanWrapper.getBean()); } } for (Map.Entry<String, XmlProperty> entry : xmlNodeInfo.getProperties().entrySet()) { XmlProperty xmlProperty = entry.getValue(); XmlParserInfo xmlParserInfo = getPropertyXmlParserInfo(context, beanType, xmlProperty.propertyName(), null, xmlProperty); if (xmlParserInfo != null) { objectParser.registerPropertyParser(xmlParserInfo.getPath(), xmlParserInfo.getParser()); } } if (ClientEventSupported.class.isAssignableFrom(beanType) && subParsers.get("ClientEvent") == null) { objectParser.registerSubParser("ClientEvent", beanFactory.getBean(CLIENT_EVENT_PARSER, XmlParser.class)); } } PropertyDescriptor[] propertyDescriptors = PropertyUtils.getPropertyDescriptors(beanType); for (PropertyDescriptor propertyDescriptor : propertyDescriptors) { String propertyName = propertyDescriptor.getName(); if ("class".equals(propertyName)) { continue; } Method readMethod = propertyDescriptor.getReadMethod(); if (readMethod == null) { continue; } if (readMethod.getDeclaringClass() != beanType) { try { readMethod = beanType.getMethod(readMethod.getName(), readMethod.getParameterTypes()); } catch (NoSuchMethodException e) { // do nothing } } TypeInfo typeInfo; Class<?> propertyType = propertyDescriptor.getPropertyType(); if (Collection.class.isAssignableFrom(propertyType)) { typeInfo = TypeInfo.parse((ParameterizedType) readMethod.getGenericReturnType(), true); propertyType = typeInfo.getType(); } else { typeInfo = new TypeInfo(propertyType, false); } XmlSubNode xmlSubNode = readMethod.getAnnotation(XmlSubNode.class); if (xmlSubNode != null) { if (StringUtils.isNotEmpty(xmlSubNode.propertyName())) { throw new IllegalArgumentException("@XmlSubNode.propertyName should be empty. [" + beanType.getName() + '#' + propertyName + "]"); } List<XmlParserInfo> xmlParserInfos = getSubNodeXmlParserInfos(context, beanType, propertyName, typeInfo, xmlSubNode); if (xmlParserInfos != null) { for (XmlParserInfo xmlParserInfo : xmlParserInfos) { objectParser.registerSubParser(xmlParserInfo.getPath(), xmlParserInfo.getParser()); } } } else { XmlProperty xmlProperty = readMethod.getAnnotation(XmlProperty.class); if (xmlProperty != null && StringUtils.isNotEmpty(xmlProperty.propertyName())) { throw new IllegalArgumentException("@XmlProperty.propertyName should be empty. [" + beanType.getName() + '#' + propertyName + "]"); } XmlParserInfo xmlParserInfo = getPropertyXmlParserInfo(context, beanType, propertyName, typeInfo, xmlProperty); if (xmlParserInfo != null) { XmlParser parser = xmlParserInfo.getParser(); if (parser instanceof TextPropertyParser) { TextPropertyParser textPropertyParser = (TextPropertyParser) parser; if (textPropertyParser.getTextParser() == null) { TextParser textParser = textParserHelper.getTextParser(propertyType); textPropertyParser.setTextParser(textParser); } } objectParser.registerPropertyParser(xmlParserInfo.getPath(), parser); } } } if (objectParser instanceof ObjectParserInitializationAware) { ((ObjectParserInitializationAware) objectParser).postObjectParserInitialized(objectParser); } Map<String, XmlParserHelperListener> listenerMap = ((ListableBeanFactory) beanFactory) .getBeansOfType(XmlParserHelperListener.class); for (XmlParserHelperListener listener : listenerMap.values()) { listener.onInitParser(this, objectParser, beanType); } }
From source file:org.apache.beehive.controls.runtime.bean.ControlBean.java
/** * Dispatches the requested operation event on the ControlBean. * @see org.apache.beehive.controls.runtime.bean.ControlContainerContext#dispatchEvent *//*from www. ja v a2 s . c o m*/ /* package */ Object dispatchEvent(EventRef event, Object[] args) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { ensureControl(); // // Translate the EventRef back to an actual event method on the ControlInterface // Class controlInterface = getControlInterface(); Method method = event.getEventMethod(controlInterface); // // Locate the target of the event // Object eventTarget = null; if (method.getDeclaringClass().isAssignableFrom(_control.getClass())) { // // If the control implementation implements that EventSet interface, then // dispatch the event directly to it, and allow it do make the decision about // how/when to dispatch to any external listeners (via a @Client notifier // instance) // eventTarget = _control; } else { // // The associated control implementation does not directly handle the event, // so find the event notifier instance for the EventSet interface associated // with the method. // eventTarget = _notifiers.get(method.getDeclaringClass()); if (eventTarget == null) throw new IllegalArgumentException("No event notifier found for " + event); } // // Dispatch the event // return method.invoke(eventTarget, args); }
From source file:ca.uhn.fhir.rest.method.BaseResourceReturningMethodBinding.java
@SuppressWarnings("unchecked") public BaseResourceReturningMethodBinding(Class<?> theReturnResourceType, Method theMethod, FhirContext theContext, Object theProvider) { super(theMethod, theContext, theProvider); Class<?> methodReturnType = theMethod.getReturnType(); if (Collection.class.isAssignableFrom(methodReturnType)) { myMethodReturnType = MethodReturnTypeEnum.LIST_OF_RESOURCES; Class<?> collectionType = ReflectionUtil.getGenericCollectionTypeOfMethodReturnType(theMethod); if (collectionType != null) { if (!Object.class.equals(collectionType) && !IBaseResource.class.isAssignableFrom(collectionType)) { throw new ConfigurationException( "Method " + theMethod.getDeclaringClass().getSimpleName() + "#" + theMethod.getName() + " returns an invalid collection generic type: " + collectionType); }/*w w w. j a v a 2 s . c o m*/ } myResourceListCollectionType = collectionType; } else if (IBaseResource.class.isAssignableFrom(methodReturnType)) { if (Modifier.isAbstract(methodReturnType.getModifiers()) == false && theContext .getResourceDefinition((Class<? extends IBaseResource>) methodReturnType).isBundle()) { myMethodReturnType = MethodReturnTypeEnum.BUNDLE_RESOURCE; } else { myMethodReturnType = MethodReturnTypeEnum.RESOURCE; } } else if (Bundle.class.isAssignableFrom(methodReturnType)) { myMethodReturnType = MethodReturnTypeEnum.BUNDLE; } else if (IBundleProvider.class.isAssignableFrom(methodReturnType)) { myMethodReturnType = MethodReturnTypeEnum.BUNDLE_PROVIDER; } else if (MethodOutcome.class.isAssignableFrom(methodReturnType)) { myMethodReturnType = MethodReturnTypeEnum.METHOD_OUTCOME; } else { throw new ConfigurationException("Invalid return type '" + methodReturnType.getCanonicalName() + "' on method '" + theMethod.getName() + "' on type: " + theMethod.getDeclaringClass().getCanonicalName()); } if (theReturnResourceType != null) { if (IBaseResource.class.isAssignableFrom(theReturnResourceType)) { if (Modifier.isAbstract(theReturnResourceType.getModifiers()) || Modifier.isInterface(theReturnResourceType.getModifiers())) { // If we're returning an abstract type, that's ok } else { myResourceType = (Class<? extends IResource>) theReturnResourceType; myResourceName = theContext.getResourceDefinition(myResourceType).getName(); } } } myPreferTypesList = createPreferTypesList(); }
From source file:com.espertech.esper.epl.expression.core.ExprNodeUtility.java
public static ExprNodeUtilMethodDesc resolveMethodAllowWildcardAndStream(String className, Class optionalClass, String methodName, List<ExprNode> parameters, MethodResolutionService methodResolutionService, EventAdapterService eventAdapterService, String statementId, boolean allowWildcard, final EventType wildcardType, ExprNodeUtilResolveExceptionHandler exceptionHandler, String functionName, TableService tableService) throws ExprValidationException { Class[] paramTypes = new Class[parameters.size()]; ExprEvaluator[] childEvals = new ExprEvaluator[parameters.size()]; int count = 0; boolean[] allowEventBeanType = new boolean[parameters.size()]; boolean[] allowEventBeanCollType = new boolean[parameters.size()]; ExprEvaluator[] childEvalsEventBeanReturnTypes = new ExprEvaluator[parameters.size()]; boolean allConstants = true; for (ExprNode childNode : parameters) { if (!EnumMethodEnum.isEnumerationMethod(methodName) && childNode instanceof ExprLambdaGoesNode) { throw new ExprValidationException( "Unexpected lambda-expression encountered as parameter to UDF or static method '" + methodName + "'"); }/* w w w . j a va2 s. c o m*/ if (childNode instanceof ExprWildcard) { if (wildcardType == null || !allowWildcard) { throw new ExprValidationException("Failed to resolve wildcard parameter to a given event type"); } childEvals[count] = new ExprNodeUtilExprEvalStreamNumUnd(0, wildcardType.getUnderlyingType()); childEvalsEventBeanReturnTypes[count] = new ExprNodeUtilExprEvalStreamNumEvent(0); paramTypes[count] = wildcardType.getUnderlyingType(); allowEventBeanType[count] = true; allConstants = false; count++; continue; } if (childNode instanceof ExprStreamUnderlyingNode) { ExprStreamUnderlyingNode und = (ExprStreamUnderlyingNode) childNode; TableMetadata tableMetadata = tableService.getTableMetadataFromEventType(und.getEventType()); if (tableMetadata == null) { childEvals[count] = childNode.getExprEvaluator(); childEvalsEventBeanReturnTypes[count] = new ExprNodeUtilExprEvalStreamNumEvent( und.getStreamId()); } else { childEvals[count] = new BindProcessorEvaluatorStreamTable(und.getStreamId(), und.getEventType().getUnderlyingType(), tableMetadata); childEvalsEventBeanReturnTypes[count] = new ExprNodeUtilExprEvalStreamNumEventTable( und.getStreamId(), tableMetadata); } paramTypes[count] = childEvals[count].getType(); allowEventBeanType[count] = true; allConstants = false; count++; continue; } if (childNode instanceof ExprEvaluatorEnumeration) { ExprEvaluatorEnumeration enumeration = (ExprEvaluatorEnumeration) childNode; EventType eventType = enumeration.getEventTypeSingle(eventAdapterService, statementId); childEvals[count] = childNode.getExprEvaluator(); paramTypes[count] = childEvals[count].getType(); allConstants = false; if (eventType != null) { childEvalsEventBeanReturnTypes[count] = new ExprNodeUtilExprEvalStreamNumEnumSingle( enumeration); allowEventBeanType[count] = true; count++; continue; } EventType eventTypeColl = enumeration.getEventTypeCollection(eventAdapterService, statementId); if (eventTypeColl != null) { childEvalsEventBeanReturnTypes[count] = new ExprNodeUtilExprEvalStreamNumEnumColl(enumeration); allowEventBeanCollType[count] = true; count++; continue; } } ExprEvaluator eval = childNode.getExprEvaluator(); childEvals[count] = eval; paramTypes[count] = eval.getType(); count++; if (!(childNode.isConstantResult())) { allConstants = false; } } // Try to resolve the method final FastMethod staticMethod; Method method; try { if (optionalClass != null) { method = methodResolutionService.resolveMethod(optionalClass, methodName, paramTypes, allowEventBeanType, allowEventBeanCollType); } else { method = methodResolutionService.resolveMethod(className, methodName, paramTypes, allowEventBeanType, allowEventBeanCollType); } FastClass declaringClass = FastClass.create(Thread.currentThread().getContextClassLoader(), method.getDeclaringClass()); staticMethod = declaringClass.getMethod(method); } catch (Exception e) { throw exceptionHandler.handle(e); } // rewrite those evaluator that should return the event itself if (CollectionUtil.isAnySet(allowEventBeanType)) { for (int i = 0; i < parameters.size(); i++) { if (allowEventBeanType[i] && method.getParameterTypes()[i] == EventBean.class) { childEvals[i] = childEvalsEventBeanReturnTypes[i]; } } } // rewrite those evaluators that should return the event collection if (CollectionUtil.isAnySet(allowEventBeanCollType)) { for (int i = 0; i < parameters.size(); i++) { if (allowEventBeanCollType[i] && method.getParameterTypes()[i] == Collection.class) { childEvals[i] = childEvalsEventBeanReturnTypes[i]; } } } // add an evaluator if the method expects a context object if (method.getParameterTypes().length > 0 && method.getParameterTypes()[method.getParameterTypes().length - 1] == EPLMethodInvocationContext.class) { childEvals = (ExprEvaluator[]) CollectionUtil.arrayExpandAddSingle(childEvals, new ExprNodeUtilExprEvalMethodContext(functionName)); } return new ExprNodeUtilMethodDesc(allConstants, paramTypes, childEvals, method, staticMethod); }