Refine search
public static <T> InvokableAnnotatedMethod<T> of(AnnotatedMethod<T> delegate) { return new InvokableAnnotatedMethod<T>(delegate); }
private boolean isMoreSpecific(InvokableAnnotatedMethod<?> candidate, InvokableAnnotatedMethod<?> mostSpecific) { for (int i = 0; i < candidate.getJavaMember().getGenericParameterTypes().length; i++) { if (Types.isMoreSpecific(candidate.getJavaMember().getGenericParameterTypes()[i], mostSpecific.getJavaMember().getGenericParameterTypes()[i])) { return true; } } return false; }
/** * Determines the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator. A decorated method * is any method declared by a decorated type which is implemented by the decorator. * * @param beanManager the bean manager * @param decorator the specified decorator * @return the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator */ public static Set<InvokableAnnotatedMethod<?>> getDecoratorMethods(BeanManagerImpl beanManager, WeldDecorator<?> decorator) { ImmutableSet.Builder<InvokableAnnotatedMethod<?>> builder = ImmutableSet.builder(); for (Type type : decorator.getDecoratedTypes()) { EnhancedAnnotatedType<?> weldClass = getEnhancedAnnotatedTypeOfDecoratedType(beanManager, type); for (EnhancedAnnotatedMethod<?, ?> method : weldClass.getDeclaredEnhancedMethods()) { if (decorator.getEnhancedAnnotated().getEnhancedMethod(method.getSignature()) != null) { builder.add(InvokableAnnotatedMethod.of(method.slim())); } } } return builder.build(); }
private boolean matches(InvokableAnnotatedMethod<?> decoratedMethod, Method candidate) { if (candidate.getParameterTypes().length != decoratedMethod.getParameters().size()) { return false; } if (!candidate.getName().equals(decoratedMethod.getJavaMember().getName())) { return false; } for (int i = 0; i < candidate.getParameterTypes().length; i++) { Type decoratedMethodParamType = decoratedMethod.getJavaMember().getGenericParameterTypes()[i]; Type candidateParamType = candidate.getGenericParameterTypes()[i]; if (Types.containsTypeVariable(decoratedMethodParamType) || Types.containsTypeVariable(candidateParamType)) { if (!decoratedMethod.getJavaMember().getParameterTypes()[i].isAssignableFrom(candidate.getParameterTypes()[i])) { return false; } } else { if (!CovariantTypes.isAssignableFrom(decoratedMethodParamType, candidateParamType)) { return false; } } } return true; }
private Object doInvoke(WeldDecorator<?> weldDecorator, Object decoratorInstance, Method method, Object[] args) throws Throwable { if (!method.isAnnotationPresent(Inject.class)) { InvokableAnnotatedMethod<?> decoratorMethod = weldDecorator.getDecoratorMethod(method); if (decoratorMethod != null) { try { return decoratorMethod.invokeOnInstance(decoratorInstance, args); } catch (InvocationTargetException e) { throw e.getCause(); } } } SecurityActions.ensureAccessible(method); return Reflections.invokeAndUnwrap(getTargetInstance(), method, args); } }
private Object findMatchingDecoratedMethod(Method method) { if (decoratedMethod.getJavaMember().equals(method)) { return decoratedMethod;
/** * Determines the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator. A decorated method * is any method declared by a decorated type which is implemented by the decorator. * * @param beanManager the bean manager * @param decorator the specified decorator * @return the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator */ public static Set<InvokableAnnotatedMethod<?>> getDecoratorMethods(BeanManagerImpl beanManager, WeldDecorator<?> decorator) { ImmutableSet.Builder<InvokableAnnotatedMethod<?>> builder = ImmutableSet.builder(); for (Type type : decorator.getDecoratedTypes()) { EnhancedAnnotatedType<?> weldClass = getEnhancedAnnotatedTypeOfDecoratedType(beanManager, type); for (EnhancedAnnotatedMethod<?, ?> method : weldClass.getDeclaredEnhancedMethods()) { if (decorator.getEnhancedAnnotated().getEnhancedMethod(method.getSignature()) != null) { builder.add(InvokableAnnotatedMethod.of(method.slim())); } } } return builder.build(); }
private boolean matches(InvokableAnnotatedMethod<?> decoratedMethod, Method candidate) { if (candidate.getParameterTypes().length != decoratedMethod.getParameters().size()) { return false; } if (!candidate.getName().equals(decoratedMethod.getJavaMember().getName())) { return false; } for (int i = 0; i < candidate.getParameterTypes().length; i++) { Type decoratedMethodParamType = decoratedMethod.getJavaMember().getGenericParameterTypes()[i]; Type candidateParamType = candidate.getGenericParameterTypes()[i]; if (Types.containsTypeVariable(decoratedMethodParamType) || Types.containsTypeVariable(candidateParamType)) { if (!decoratedMethod.getJavaMember().getParameterTypes()[i].isAssignableFrom(candidate.getParameterTypes()[i])) { return false; } } else { if (!CovariantTypes.isAssignableFrom(decoratedMethodParamType, candidateParamType)) { return false; } } } return true; }
private Object doInvoke(WeldDecorator<?> weldDecorator, Object decoratorInstance, Method method, Object[] args) throws Throwable { if (!method.isAnnotationPresent(Inject.class)) { InvokableAnnotatedMethod<?> decoratorMethod = weldDecorator.getDecoratorMethod(method); if (decoratorMethod != null) { try { return decoratorMethod.invokeOnInstance(decoratorInstance, args); } catch (InvocationTargetException e) { throw e.getCause(); } } } SecurityActions.ensureAccessible(method); return Reflections.invokeAndUnwrap(getTargetInstance(), method, args); } }
private Object findMatchingDecoratedMethod(Method method) { if (decoratedMethod.getJavaMember().equals(method)) { return decoratedMethod;
/** * Determines the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator. A decorated method * is any method declared by a decorated type which is implemented by the decorator. * * @param beanManager the bean manager * @param decorator the specified decorator * @return the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator */ public static Set<InvokableAnnotatedMethod<?>> getDecoratorMethods(BeanManagerImpl beanManager, WeldDecorator<?> decorator) { ImmutableSet.Builder<InvokableAnnotatedMethod<?>> builder = ImmutableSet.builder(); for (Type type : decorator.getDecoratedTypes()) { EnhancedAnnotatedType<?> weldClass = getEnhancedAnnotatedTypeOfDecoratedType(beanManager, type); for (EnhancedAnnotatedMethod<?, ?> method : weldClass.getDeclaredEnhancedMethods()) { if (decorator.getEnhancedAnnotated().getEnhancedMethod(method.getSignature()) != null) { builder.add(InvokableAnnotatedMethod.of(method.slim())); } } } return builder.build(); }
private boolean matches(InvokableAnnotatedMethod<?> decoratedMethod, Method candidate) { if (candidate.getParameterTypes().length != decoratedMethod.getParameters().size()) { return false; } if (!candidate.getName().equals(decoratedMethod.getJavaMember().getName())) { return false; } for (int i = 0; i < candidate.getParameterTypes().length; i++) { Type decoratedMethodParamType = decoratedMethod.getJavaMember().getGenericParameterTypes()[i]; Type candidateParamType = candidate.getGenericParameterTypes()[i]; if (Types.containsTypeVariable(decoratedMethodParamType) || Types.containsTypeVariable(candidateParamType)) { if (!decoratedMethod.getJavaMember().getParameterTypes()[i].isAssignableFrom(candidate.getParameterTypes()[i])) { return false; } } else { if (!CovariantTypes.isAssignableFrom(decoratedMethodParamType, candidateParamType)) { return false; } } } return true; }
private boolean isMoreSpecific(InvokableAnnotatedMethod<?> candidate, InvokableAnnotatedMethod<?> mostSpecific) { for (int i = 0; i < candidate.getJavaMember().getGenericParameterTypes().length; i++) { if (Types.isMoreSpecific(candidate.getJavaMember().getGenericParameterTypes()[i], mostSpecific.getJavaMember().getGenericParameterTypes()[i])) { return true; } } return false; }
private Object doInvoke(WeldDecorator<?> weldDecorator, Object decoratorInstance, Method method, Object[] args) throws Throwable { if (!method.isAnnotationPresent(Inject.class)) { InvokableAnnotatedMethod<?> decoratorMethod = weldDecorator.getDecoratorMethod(method); if (decoratorMethod != null) { try { return decoratorMethod.invokeOnInstance(decoratorInstance, args); } catch (InvocationTargetException e) { throw e.getCause(); } } } SecurityActions.ensureAccessible(method); return Reflections.invokeAndUnwrap(getTargetInstance(), method, args); } }
public static <T> InvokableAnnotatedMethod<T> of(AnnotatedMethod<T> delegate) { return new InvokableAnnotatedMethod<T>(delegate); }
private Object findMatchingDecoratedMethod(Method method) { if (decoratedMethod.getJavaMember().equals(method)) { return decoratedMethod;
/** * Determines the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator. A decorated method * is any method declared by a decorated type which is implemented by the decorator. * * @param beanManager the bean manager * @param decorator the specified decorator * @return the set of {@link InvokableAnnotatedMethod}s representing decorated methods of the specified decorator */ public static Set<InvokableAnnotatedMethod<?>> getDecoratorMethods(BeanManagerImpl beanManager, WeldDecorator<?> decorator) { ImmutableSet.Builder<InvokableAnnotatedMethod<?>> builder = ImmutableSet.builder(); for (Type type : decorator.getDecoratedTypes()) { EnhancedAnnotatedType<?> weldClass = getEnhancedAnnotatedTypeOfDecoratedType(beanManager, type); for (EnhancedAnnotatedMethod<?, ?> method : weldClass.getDeclaredEnhancedMethods()) { if (decorator.getEnhancedAnnotated().getEnhancedMethod(method.getSignature()) != null) { builder.add(InvokableAnnotatedMethod.of(method.slim())); } } } return builder.build(); }
private boolean matches(InvokableAnnotatedMethod<?> decoratedMethod, Method candidate) { if (candidate.getParameterTypes().length != decoratedMethod.getParameters().size()) { return false; } if (!candidate.getName().equals(decoratedMethod.getJavaMember().getName())) { return false; } for (int i = 0; i < candidate.getParameterTypes().length; i++) { Type decoratedMethodParamType = decoratedMethod.getJavaMember().getGenericParameterTypes()[i]; Type candidateParamType = candidate.getGenericParameterTypes()[i]; if (Types.containsTypeVariable(decoratedMethodParamType) || Types.containsTypeVariable(candidateParamType)) { if (!decoratedMethod.getJavaMember().getParameterTypes()[i].isAssignableFrom(candidate.getParameterTypes()[i])) { return false; } } else { if (!CovariantTypes.isAssignableFrom(decoratedMethodParamType, candidateParamType)) { return false; } } } return true; }
private boolean isMoreSpecific(InvokableAnnotatedMethod<?> candidate, InvokableAnnotatedMethod<?> mostSpecific) { for (int i = 0; i < candidate.getJavaMember().getGenericParameterTypes().length; i++) { if (Types.isMoreSpecific(candidate.getJavaMember().getGenericParameterTypes()[i], mostSpecific.getJavaMember().getGenericParameterTypes()[i])) { return true; } } return false; }
private Object doInvoke(WeldDecorator<?> weldDecorator, Object decoratorInstance, Method method, Object[] args) throws Throwable { if (!method.isAnnotationPresent(Inject.class)) { InvokableAnnotatedMethod<?> decoratorMethod = weldDecorator.getDecoratorMethod(method); if (decoratorMethod != null) { try { return decoratorMethod.invokeOnInstance(decoratorInstance, args); } catch (InvocationTargetException e) { throw e.getCause(); } } } SecurityActions.ensureAccessible(method); return Reflections.invokeAndUnwrap(getTargetInstance(), method, args); } }