static boolean hasInjectionPoints(AnnotatedMember<?> member) { if (!(member instanceof AnnotatedMethod)) return false; AnnotatedMethod<?> method = (AnnotatedMethod<?>) member; for (AnnotatedParameter<?> parameter : method.getParameters()) { if (parameter.getBaseType().equals(InjectionPoint.class)) return true; } return false; } }
@Test @SpecAssertion(section = "11.5.9", id = "aba") public void testGetAnnotatedMethod() { assert ProcessObserverMethodObserver.getAnnotatedMethod().getParameters().iterator().next().getBaseType().equals(EventA.class); }
public AnnotatedParameterImpl(AnnotatedParameter<? super T> param, Set<Annotation> annotations, AnnotatedCallable<T> declaringCallable) { this(param.getBaseType(), param.getTypeClosure(), annotations, declaringCallable, param.getPosition()); }
public MethodSignatureImpl(AnnotatedMethod<?> method) { this.methodName = method.getJavaMember().getName(); this.parameterTypes = new String[method.getParameters().size()]; for (int i = 0; i < method.getParameters().size(); i++) { parameterTypes[i] = Reflections.getRawType(method.getParameters().get(i).getBaseType()).getName(); } }
public MethodSignatureImpl(AnnotatedMethod<?> method) { this.methodName = method.getJavaMember().getName(); this.parameterTypes = new String[method.getParameters().size()]; for (int i = 0; i < method.getParameters().size(); i++) { parameterTypes[i] = Reflections.getRawType(method.getParameters().get(i).getBaseType()).getName(); } }
public MethodSignatureImpl(AnnotatedMethod<?> method) { this.methodName = method.getJavaMember().getName(); this.parameterTypes = new String[method.getParameters().size()]; for (int i = 0; i < method.getParameters().size(); i++) { parameterTypes[i] = Reflections.getRawType(method.getParameters().get(i).getBaseType()).getName(); } }
@Test @SpecAssertion(section = PROCESS_ANNOTATED_TYPE, id = "bba") public void configuratorInitializedWithOriginalAT() { AnnotatedType<Cat> catAT = getCurrentManager().getExtension(ProcessAnnotatedTypeObserver.class).getOriginalCatAT(); assertTrue(catAT.isAnnotationPresent(RequestScoped.class)); AnnotatedConstructor<Cat> annotatedConstructor = catAT.getConstructors().stream() .filter(ac -> ac.getParameters().size() == 1 && ac.getParameters().get(0).getBaseType().equals(Feed.class)).findFirst().get(); assertTrue(annotatedConstructor.getParameters().iterator().next().isAnnotationPresent(Cats.class)); assertTrue(annotatedConstructor.isAnnotationPresent(Inject.class)); }
public AnnotatedParameterImpl(AnnotatedParameter<? super T> param, AnnotatedCallable<T> declaringCallable) { this(param.getBaseType(), param.getTypeClosure(), param.getAnnotations(), declaringCallable, param.getPosition()); }
@Override protected InterceptionFactory<?> newInstance(InjectionPoint ip, CreationalContext<InterceptionFactory<?>> creationalContext) { AnnotatedParameter<?> annotatedParameter = (AnnotatedParameter<?>) ip.getAnnotated(); ParameterizedType parameterizedType = (ParameterizedType) annotatedParameter.getBaseType(); AnnotatedType<?> annotatedType = beanManager.createAnnotatedType(Reflections.getRawType(parameterizedType.getActualTypeArguments()[0])); return InterceptionFactoryImpl.of(beanManager, creationalContext, annotatedType); }
public AnnotatedParameterImpl(AnnotatedParameter<? super T> param, AnnotatedCallable<T> declaringCallable) { this(param.getBaseType(), param.getTypeClosure(), param.getAnnotations(), declaringCallable, param.getPosition()); }
@Override protected InterceptionFactory<?> newInstance(InjectionPoint ip, CreationalContext<InterceptionFactory<?>> creationalContext) { AnnotatedParameter<?> annotatedParameter = (AnnotatedParameter<?>) ip.getAnnotated(); ParameterizedType parameterizedType = (ParameterizedType) annotatedParameter.getBaseType(); AnnotatedType<?> annotatedType = beanManager.createAnnotatedType(Reflections.getRawType(parameterizedType.getActualTypeArguments()[0])); return InterceptionFactoryImpl.of(beanManager, creationalContext, annotatedType); }
public UnbackedAnnotatedMethod(Type baseType, Set<Type> typeClosure, Set<Annotation> annotations, UnbackedAnnotatedType<X> declaringType, List<AnnotatedParameter<X>> originalParameters, Method method, SharedObjectCache cache) { super(baseType, typeClosure, cache.getSharedSet(annotations), declaringType); this.method = method; List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>(originalParameters.size()); for (AnnotatedParameter<X> originalParameter : originalParameters) { parameters.add(new UnbackedAnnotatedParameter<X>(originalParameter.getBaseType(), originalParameter.getTypeClosure(), cache.getSharedSet(originalParameter.getAnnotations()), originalParameter.getPosition(), this)); } this.parameters = immutableListView(parameters); }
public UnbackedAnnotatedMethod(Type baseType, Set<Type> typeClosure, Set<Annotation> annotations, UnbackedAnnotatedType<X> declaringType, List<AnnotatedParameter<X>> originalParameters, Method method, SharedObjectCache cache) { super(baseType, typeClosure, cache.getSharedSet(annotations), declaringType); this.method = method; List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>(originalParameters.size()); for (AnnotatedParameter<X> originalParameter : originalParameters) { parameters.add(new UnbackedAnnotatedParameter<X>(originalParameter.getBaseType(), originalParameter.getTypeClosure(), cache.getSharedSet(originalParameter.getAnnotations()), originalParameter.getPosition(), this)); } this.parameters = ImmutableList.copyOf(parameters); }
public UnbackedAnnotatedConstructor(Type baseType, Set<Type> typeClosure, Set<Annotation> annotations, UnbackedAnnotatedType<X> declaringType, List<AnnotatedParameter<X>> originalParameters, Constructor<X> constructor, SharedObjectCache cache) { super(baseType, typeClosure, cache.getSharedSet(annotations), declaringType); this.constructor = constructor; List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>(originalParameters.size()); for (AnnotatedParameter<X> originalParameter : originalParameters) { parameters.add(new UnbackedAnnotatedParameter<X>(originalParameter.getBaseType(), originalParameter.getTypeClosure(), cache.getSharedSet(originalParameter.getAnnotations()), originalParameter.getPosition(), this)); } this.parameters = ImmutableList.copyOf(parameters); }
public UnbackedAnnotatedMethod(Type baseType, Set<Type> typeClosure, Set<Annotation> annotations, UnbackedAnnotatedType<X> declaringType, List<AnnotatedParameter<X>> originalParameters, Method method, SharedObjectCache cache) { super(baseType, typeClosure, cache.getSharedSet(annotations), declaringType); this.method = method; List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>(originalParameters.size()); for (AnnotatedParameter<X> originalParameter : originalParameters) { parameters.add(new UnbackedAnnotatedParameter<X>(originalParameter.getBaseType(), originalParameter.getTypeClosure(), cache.getSharedSet(originalParameter.getAnnotations()), originalParameter.getPosition(), this)); } this.parameters = ImmutableList.copyOf(parameters); }
public UnbackedAnnotatedConstructor(Type baseType, Set<Type> typeClosure, Set<Annotation> annotations, UnbackedAnnotatedType<X> declaringType, List<AnnotatedParameter<X>> originalParameters, Constructor<X> constructor, SharedObjectCache cache) { super(baseType, typeClosure, cache.getSharedSet(annotations), declaringType); this.constructor = constructor; List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>(originalParameters.size()); for (AnnotatedParameter<X> originalParameter : originalParameters) { parameters.add(new UnbackedAnnotatedParameter<X>(originalParameter.getBaseType(), originalParameter.getTypeClosure(), cache.getSharedSet(originalParameter.getAnnotations()), originalParameter.getPosition(), this)); } this.parameters = ImmutableList.copyOf(parameters); }
public UnbackedAnnotatedConstructor(Type baseType, Set<Type> typeClosure, Set<Annotation> annotations, UnbackedAnnotatedType<X> declaringType, List<AnnotatedParameter<X>> originalParameters, Constructor<X> constructor, SharedObjectCache cache) { super(baseType, typeClosure, cache.getSharedSet(annotations), declaringType); this.constructor = constructor; List<AnnotatedParameter<X>> parameters = new ArrayList<AnnotatedParameter<X>>(originalParameters.size()); for (AnnotatedParameter<X> originalParameter : originalParameters) { parameters.add(new UnbackedAnnotatedParameter<X>(originalParameter.getBaseType(), originalParameter.getTypeClosure(), cache.getSharedSet(originalParameter.getAnnotations()), originalParameter.getPosition(), this)); } this.parameters = ImmutableList.copyOf(parameters); }
public static <T, X> ParameterInjectionPointAttributes<T, X> fire(ParameterInjectionPointAttributes<T, X> attributes, Class<?> declaringComponentClass, BeanManagerImpl manager) { ProcessInjectionPointImpl<T, X> event = new ProcessInjectionPointImpl<T, X>(attributes, declaringComponentClass, manager, attributes.getAnnotated().getBaseType()) { }; event.fire(); if (!event.isDirty()) { return attributes; } else { return ForwardingParameterInjectionPointAttributes.of(event.getInjectionPointInternal()); } }
public static <T, X> ParameterInjectionPointAttributes<T, X> fire(ParameterInjectionPointAttributes<T, X> attributes, Class<?> declaringComponentClass, BeanManagerImpl manager) { ProcessInjectionPointImpl<T, X> event = new ProcessInjectionPointImpl<T, X>(attributes, declaringComponentClass, manager, attributes.getAnnotated().getBaseType()) { }; event.fire(); if (!event.isDirty()) { return attributes; } else { return ForwardingParameterInjectionPointAttributes.of(event.getInjectionPointInternal()); } }
public static <T, X> ParameterInjectionPointAttributes<T, X> fire(ParameterInjectionPointAttributes<T, X> attributes, Class<?> declaringComponentClass, BeanManagerImpl manager) { ProcessInjectionPointImpl<T, X> event = new ProcessInjectionPointImpl<T, X>(attributes, declaringComponentClass, manager, attributes.getAnnotated().getBaseType()) { }; event.fire(); if (!event.isDirty()) { return attributes; } else { return ForwardingParameterInjectionPointAttributes.of(event.getInjectionPointInternal()); } }