public Class getType() throws ExprValidationException { if(staticMethod == null) { throw new IllegalStateException("ExprStaticMethodNode has not been validated"); } return staticMethod.getReturnType(); }
public Class getType() throws ExprValidationException { if(instanceMethod == null) { throw new IllegalStateException("ExprStaticMethodNode has not been validated"); } return instanceMethod.getReturnType(); }
public Class getPropertyType(String name) { Operation oper = (Operation) getters.get(name); return oper.method.getReturnType(); }
/** * Ctor. * @param eventAdapterService for generating event beans * @param method the method to invoke * @param useMapType is true to indicate that Map-events are generated * @param eventType is the event type to use */ public MethodPollingExecStrategy(EventAdapterService eventAdapterService, FastMethod method, boolean useMapType, EventType eventType) { this.eventAdapterService = eventAdapterService; this.method = method; this.isArray = method.getReturnType().isArray(); this.useMapType = useMapType; this.eventType = eventType; }
private boolean dispatchBefore(Dispatcher<BaseType> dispatcher, BaseType instance) { FastMethod method = getMethod(dispatcher, instance); if (method == null) { return true; // non-presence of before method means continue execution } try { Object result = method.invoke(this, new Object[]{ instance }); if (method.getReturnType().equals(Boolean.TYPE)) { return Boolean.class.cast(result); // method determines whether to continue } return true; } catch (InvocationTargetException e) { throw Throwables.propagate(e.getCause()); } }
private boolean dispatchBefore(Dispatcher<BaseType> dispatcher, BaseType instance) { FastMethod method = getMethod(dispatcher, instance); if (method == null) { return true; // non-presence of before method means continue execution } try { Object result = method.invoke(this, new Object[]{ instance }); if (method.getReturnType().equals(Boolean.TYPE)) { return Boolean.class.cast(result); // method determines whether to continue } return true; } catch (InvocationTargetException e) { throw Throwables.propagate(e.getCause()); } }
/** * 根据executor返回对应的参数类型 */ public Class getGetClass(GetExecutor getExecutor, Class srcRefClass, Class getResultClass) { // 设置为自动提取的targetClasss if (getExecutor instanceof MapGetExecutor) { if (getResultClass != null) { return getResultClass;// 优先设置为getResult的class对象 } } else if (getExecutor instanceof FastPropertyGetExecutor) { return ((FastPropertyGetExecutor) getExecutor).getMethod().getReturnType(); // 获取getExecutor方法的返回结果类型 } else if (getExecutor instanceof PropertyGetExecutor) { return ((PropertyGetExecutor) getExecutor).getMethod().getReturnType(); // 获取getExecutor方法的返回结果类型 } else if (getExecutor instanceof FieldGetExecutor) { return ((FieldGetExecutor) getExecutor).getField().getType(); // 获取属性的类型 } else if (getExecutor instanceof ThisSymbolGetExecutor) { return srcRefClass; // 返回对应src的类型 } return null; // throw new BeanMappingException("unknow GetExecutor"); }
private Class< ? > resolveType(IExpression[] exprs) { //获得函数参数类型 Class< ? >[] paramTypes = new Class[exprs.length]; for (int i = 0; i < paramTypes.length; i++) { paramTypes[i] = exprs[i].getType(); } //获得相应方法 Method method = MethodResolver.resolveMethod(declareClass, methodName, paramTypes); if (null == method) { UDFAnnotation annotation = declareClass.getAnnotation(UDFAnnotation.class); String functionName = annotation == null ? declareClass.getSimpleName() : annotation.value(); StreamingRuntimeException exception = new StreamingRuntimeException(ErrorCode.FUNCTION_UNSUPPORTED_PARAMETERS, functionName); LOG.error(ErrorCode.FUNCTION_UNSUPPORTED_PARAMETERS.getFullMessage(functionName)); throw exception; } FastClass declaringClass = FastClass.create(Thread.currentThread().getContextClassLoader(), method.getDeclaringClass()); FastMethod md = declaringClass.getMethod(method); return warpDataType(md.getReturnType()); }
protected BulkBean buildGetBulkBean(Introspector is, Class<?> clazz, String[] fields, Class[] args) { if (fields.length != args.length) { throw new BeanMappingException("fields and args size is not match!"); } String[] getters = new String[fields.length]; String[] setters = new String[fields.length]; for (int i = 0; i < fields.length; i++) { String property = fields[i]; Class arg = args[i]; FastMethod setMethod = FastPropertySetExecutor.discover(is, clazz, property, arg); FastMethod getMethod = FastPropertyGetExecutor.discover(is, clazz, property); if (setMethod == null) { throw new BeanMappingException("class[" + clazz.getName() + "] field[" + property + "] arg[" + arg.getName() + "] set Method is not exist!"); } if (getMethod == null) { throw new BeanMappingException("class[" + clazz.getName() + "] field[" + property + "] get Method is not exist!"); } if (getMethod.getReturnType() != arg) { throw new BeanMappingException("class[" + clazz.getName() + "] field[" + property + "] getMethod does not match declared type"); } setters[i] = setMethod.getName(); getters[i] = getMethod.getName(); } bulkBean = BulkBean.create(clazz, getters, setters, args); return bulkBean; }
Class beanClass = staticMethod.getReturnType(); if ((beanClass == void.class) || (beanClass == Void.class) || (JavaClassHelper.isJavaBuiltinDataType(beanClass))) if (staticMethod.getReturnType().isArray()) beanClass = staticMethod.getReturnType().getComponentType(); if ( (JavaClassHelper.isImplementsInterface(staticMethod.getReturnType(), Map.class)) || (staticMethod.getReturnType().isArray() && JavaClassHelper.isImplementsInterface(staticMethod.getReturnType().getComponentType(), Map.class)) )