public Set<AnnotatedConstructor<T>> getConstructors() { return delegate.getConstructors(); }
@Override public Set<AnnotatedConstructor> getConstructors() { final Set<AnnotatedConstructor> result = new HashSet<>(); for (final AnnotatedConstructor c : annotatedType.getConstructors()) { result.add(enrichedConstructor(c)); } return result; }
private boolean containsJaxRsConstructorInjection(final AnnotatedType annotatedType) { return containAnnotatedParameters(annotatedType.getConstructors(), JAX_RS_INJECT_ANNOTATIONS); }
private boolean containsJaxRsParameterizedCtor(final AnnotatedType annotatedType) { return containAnnotatedParameters(annotatedType.getConstructors(), JaxRsParamProducer.JAX_RS_STRING_PARAM_ANNOTATIONS); }
public Set<AnnotatedConstructor<TYPE>> getConstructors() { return delegate.getConstructors(); }
private void buildWrappedCallable(Set<AnnotatedCallable<? super T>> constrainedCallables) { for ( AnnotatedConstructor<T> constructor : wrappedType.getConstructors() ) { if ( constrainedCallables.contains( constructor ) ) { ValidationEnabledAnnotatedConstructor<T> wrappedConstructor = new ValidationEnabledAnnotatedConstructor<T>( constructor ); wrappedConstructors.add( wrappedConstructor ); } else { wrappedConstructors.add( constructor ); } } for ( AnnotatedMethod<? super T> method : wrappedType.getMethods() ) { if ( constrainedCallables.contains( method ) ) { ValidationEnabledAnnotatedMethod<? super T> wrappedMethod = wrap( method ); wrappedMethods.add( wrappedMethod ); } else { wrappedMethods.add( method ); } } }
private <T> void determineConstrainedConstructors(AnnotatedType<T> type, BeanDescriptor beanDescriptor, Set<AnnotatedCallable<? super T>> callables) { Class<?> clazz = type.getJavaClass(); EnumSet<ExecutableType> classLevelExecutableTypes = executableTypesDefinedOnType( clazz ); for ( AnnotatedConstructor<T> annotatedConstructor : type.getConstructors() ) { Constructor<?> constructor = annotatedConstructor.getJavaMember(); EnumSet<ExecutableType> memberLevelExecutableType = executableTypesDefinedOnConstructor( constructor ); if ( veto( classLevelExecutableTypes, memberLevelExecutableType, ExecutableType.CONSTRUCTORS ) ) { continue; } if ( beanDescriptor.getConstraintsForConstructor( constructor.getParameterTypes() ) != null ) { callables.add( annotatedConstructor ); } } }
@Override public Set<AnnotatedConstructor<X>> getConstructors() { return original.getConstructors(); }
public static boolean hasSimpleCdiConstructor(AnnotatedType<?> type) { for (AnnotatedConstructor<?> constructor : type.getConstructors()) { if (constructor.getParameters().isEmpty()) { return true; } if (constructor.isAnnotationPresent(Inject.class)) { return true; } } return false; }
public static boolean hasSimpleCdiConstructor(AnnotatedType<?> type) { for (AnnotatedConstructor<?> constructor : type.getConstructors()) { if (constructor.getParameters().isEmpty()) { return true; } if (constructor.isAnnotationPresent(Inject.class)) { return true; } } return false; }
public static boolean hasSimpleCdiConstructor(AnnotatedType<?> type) { for (AnnotatedConstructor<?> constructor : type.getConstructors()) { if (constructor.getParameters().isEmpty()) { return true; } if (constructor.isAnnotationPresent(Inject.class)) { return true; } } return false; }
public AnnotatedTypeConfiguratorImpl(AnnotatedType<T> annotatedType) { super(annotatedType); this.constructors = annotatedType.getConstructors().stream().map(c -> AnnotatedConstructorConfiguratorImpl.from(c)).collect(ImmutableSet.collector()); this.methods = annotatedType.getMethods().stream().map(m -> AnnotatedMethodConfiguratorImpl.from(m)).collect(ImmutableSet.collector()); this.fields = annotatedType.getFields().stream().map(f -> AnnotatedFieldConfiguratorImpl.from(f)).collect(ImmutableSet.collector()); }
private <T> boolean computeIsConstructorValidated(Class<T> targetClass, Constructor<T> ctor) { final AnnotatedType<T> annotatedType = CDI.current().getBeanManager().createAnnotatedType(ctor.getDeclaringClass()); final ValidateOnExecution annotation = annotatedType.getConstructors().stream().filter(ac -> ctor.equals(ac.getJavaMember())).findFirst() .map(ac -> ac.getAnnotation(ValidateOnExecution.class)) .orElseGet(() -> ctor.getAnnotation(ValidateOnExecution.class)); final Set<ExecutableType> validatedExecutableTypes = annotation == null ? classConfiguration : ExecutableTypes.interpret(annotation.type()); return validatedExecutableTypes.contains(ExecutableType.CONSTRUCTORS); }
/** * Generates a unique signature for an annotated type. Members without * annotations are omitted to reduce the length of the signature * * @param <X> * @param annotatedType * @return */ public static <X> String createTypeId(AnnotatedType<X> annotatedType) { return createTypeId(annotatedType.getJavaClass(), annotatedType.getAnnotations(), annotatedType.getMethods(), annotatedType.getFields(), annotatedType.getConstructors()); }
public <T> void collect(@Observes ProcessManagedBean<T> event) { for (AnnotatedField<?> field : event.getAnnotatedBeanClass().getFields()) { addAnnotatedTypeIfNecessary(field); } for (AnnotatedConstructor<?> constructor : event.getAnnotatedBeanClass().getConstructors()) { for (AnnotatedParameter<?> parameter : constructor.getParameters()) { addAnnotatedTypeIfNecessary(parameter); } } }
public static void validateAnnotatedType(AnnotatedType<?> type) { validateAnnotated(type); checkNotNull(type.getJavaClass(), "getJavaClass()", type); checkNotNull(type.getFields(), "getFields()", type); checkNotNull(type.getConstructors(), "getConstructors()", type); checkNotNull(type.getMethods(), "getMethods()", type); checkSensibility(type); }
public static void validateAnnotatedType(AnnotatedType<?> type) { validateAnnotated(type); checkNotNull(type.getJavaClass(), "getJavaClass()", type); checkNotNull(type.getFields(), "getFields()", type); checkNotNull(type.getConstructors(), "getConstructors()", type); checkNotNull(type.getMethods(), "getMethods()", type); checkSensibility(type); }
private boolean hasExcludeAnnotation(AbstractClassBean<?> classBean, Pattern excludeAnnotation) { AnnotatedType<?> annotatedType = classBean.getAnnotated(); return hasExcludeAnnotation(annotatedType, excludeAnnotation) || anyHasExcludeAnnotation(annotatedType.getMethods(), excludeAnnotation) || anyHasExcludeAnnotation(annotatedType.getFields(), excludeAnnotation) || anyHasExcludeAnnotation(annotatedType.getConstructors(), excludeAnnotation); }
private boolean hasExcludeAnnotation(AbstractClassBean<?> classBean, Pattern excludeAnnotation) { AnnotatedType<?> annotatedType = classBean.getAnnotated(); return hasExcludeAnnotation(annotatedType, excludeAnnotation) || anyHasExcludeAnnotation(annotatedType.getMethods(), excludeAnnotation) || anyHasExcludeAnnotation(annotatedType.getFields(), excludeAnnotation) || anyHasExcludeAnnotation(annotatedType.getConstructors(), excludeAnnotation); }
private boolean hasExcludeAnnotation(AbstractClassBean<?> classBean, Pattern excludeAnnotation) { AnnotatedType<?> annotatedType = classBean.getAnnotated(); return hasExcludeAnnotation(annotatedType, excludeAnnotation) || anyHasExcludeAnnotation(annotatedType.getMethods(), excludeAnnotation) || anyHasExcludeAnnotation(annotatedType.getFields(), excludeAnnotation) || anyHasExcludeAnnotation(annotatedType.getConstructors(), excludeAnnotation); }