public static ReflectionCache newInstance(TypeStore store) { if (Reflections.isClassLoadable(HOTSPOT_MARKER, WeldClassLoaderResourceLoader.INSTANCE)) { return new HotspotReflectionCache(store); } else { return new DefaultReflectionCache(store); } } }
public Set<Annotation> findTopLevelScopeDefinitions(Class<?> javaClass) { for (Class<?> clazz = javaClass; clazz != null && clazz != Object.class; clazz = clazz.getSuperclass()) { Set<Annotation> scopes = new HashSet<Annotation>(); for (Annotation annotation : getDeclaredAnnotations(clazz)) { if (getAnnotationClass(annotation.annotationType()).isScope()) { scopes.add(annotation); } } if (scopes.size() > 0) { return scopes; } } throw new IllegalStateException(); } }
@Override public Annotations apply(AnnotatedElement input) { return new Annotations(internalGetAnnotations(input)); } });
@Override public Set<Annotation> apply(Class<?> javaClass) { Set<Annotation> annotations = getAnnotations(javaClass); boolean scopeFound = false; for (Annotation annotation : annotations) { boolean isScope = getAnnotationClass(annotation.annotationType()).isScope(); if (isScope && scopeFound) { // there are at least two scopes, we need to choose one using scope inheritance rules (4.1) return applyScopeInheritanceRules(annotations, javaClass); } if (isScope) { scopeFound = true; } } return annotations; }
public Set<Annotation> applyScopeInheritanceRules(Set<Annotation> annotations, Class<?> javaClass) { ImmutableSet.Builder<Annotation> result = ImmutableSet.builder(); for (Annotation annotation : annotations) { if (!getAnnotationClass(annotation.annotationType()).isScope()) { result.add(annotation); } } result.addAll(findTopLevelScopeDefinitions(javaClass)); return result.build(); }
public Set<Annotation> findTopLevelScopeDefinitions(Class<?> javaClass) { for (Class<?> clazz = javaClass; clazz != null && clazz != Object.class; clazz = clazz.getSuperclass()) { Set<Annotation> scopes = new HashSet<Annotation>(); for (Annotation annotation : getDeclaredAnnotations(clazz)) { if (isScopeAnnotation.getValue(annotation.annotationType())) { scopes.add(annotation); } } if (scopes.size() > 0) { return scopes; } } throw new IllegalStateException(); } }
@Override public Set<Annotation> apply(Class<?> javaClass) { Set<Annotation> annotations = getAnnotationSet(javaClass); boolean scopeFound = false; for (Annotation annotation : annotations) { boolean isScope = isScopeAnnotation.getValue(annotation.annotationType()); if (isScope && scopeFound) { // there are at least two scopes, we need to choose one using scope inheritance rules (4.1) return applyScopeInheritanceRules(annotations, javaClass); } if (isScope) { scopeFound = true; } } return annotations; }
@Override public Set<Annotation> apply(BackedAnnotatedParameter<?> parameter) { final Member member = parameter.getDeclaringCallable().getJavaMember(); if (member instanceof Method) { return ImmutableSet.of(getParameterAnnotations((Method) member, parameter.getPosition())); } else { return ImmutableSet.of(getParameterAnnotations((Constructor<?>) member, parameter.getPosition())); } }
@Override public Set<Annotation> apply(Class<?> javaClass) { Set<Annotation> annotations = getAnnotations(javaClass); boolean scopeFound = false; for (Annotation annotation : annotations) { boolean isScope = getAnnotationClass(annotation.annotationType()).isScope(); if (isScope && scopeFound) { // there are at least two scopes, we need to choose one using scope inheritance rules (4.1) return applyScopeInheritanceRules(annotations, javaClass); } if (isScope) { scopeFound = true; } } return annotations; }
public Set<Annotation> applyScopeInheritanceRules(Set<Annotation> annotations, Class<?> javaClass) { ImmutableSet.Builder<Annotation> result = ImmutableSet.builder(); for (Annotation annotation : annotations) { if (!getAnnotationClass(annotation.annotationType()).isScope()) { result.add(annotation); } } result.addAll(findTopLevelScopeDefinitions(javaClass)); return result.build(); }
public Set<Annotation> findTopLevelScopeDefinitions(Class<?> javaClass) { for (Class<?> clazz = javaClass; clazz != null && clazz != Object.class; clazz = clazz.getSuperclass()) { Set<Annotation> scopes = new HashSet<Annotation>(); for (Annotation annotation : getDeclaredAnnotations(clazz)) { if (getAnnotationClass(annotation.annotationType()).isScope()) { scopes.add(annotation); } } if (scopes.size() > 0) { return scopes; } } throw new IllegalStateException(); } }
@Override public Set<Annotation> apply(Class<?> javaClass) { Set<Annotation> annotations = getAnnotations(javaClass); boolean scopeFound = false; for (Annotation annotation : annotations) { boolean isScope = getAnnotationClass(annotation.annotationType()).isScope(); if (isScope && scopeFound) { // there are at least two scopes, we need to choose one using scope inheritance rules (4.1) return applyScopeInheritanceRules(annotations, javaClass); } if (isScope) { scopeFound = true; } } return annotations; }
@Override public AnnotationClass<?> apply(Class<? extends Annotation> input) { boolean scope = input.isAnnotationPresent(NormalScope.class) || input.isAnnotationPresent(Scope.class) || store.isExtraScope(input); Method repeatableAnnotationAccessor = Annotations.getRepeatableAnnotationAccessor(input); Set<Annotation> metaAnnotations = ImmutableSet.of(internalGetAnnotations(input)); return new AnnotationClassImpl<>(scope, repeatableAnnotationAccessor, metaAnnotations); } }
public static ReflectionCache newInstance(TypeStore store) { if (Reflections.isClassLoadable(HOTSPOT_MARKER, WeldClassLoaderResourceLoader.INSTANCE)) { return new HotspotReflectionCache(store); } else { return new DefaultReflectionCache(store); } } }
public Set<Annotation> applyScopeInheritanceRules(Set<Annotation> annotations, Class<?> javaClass) { ImmutableSet.Builder<Annotation> result = ImmutableSet.builder(); for (Annotation annotation : annotations) { if (!getAnnotationClass(annotation.annotationType()).isScope()) { result.add(annotation); } } result.addAll(findTopLevelScopeDefinitions(javaClass)); return result.build(); }
public Set<Annotation> findTopLevelScopeDefinitions(Class<?> javaClass) { for (Class<?> clazz = javaClass; clazz != null && clazz != Object.class; clazz = clazz.getSuperclass()) { Set<Annotation> scopes = new HashSet<Annotation>(); for (Annotation annotation : getDeclaredAnnotations(clazz)) { if (getAnnotationClass(annotation.annotationType()).isScope()) { scopes.add(annotation); } } if (scopes.size() > 0) { return scopes; } } throw new IllegalStateException(); } }
@Override public Set<Annotation> apply(Class<?> javaClass) { Set<Annotation> annotations = getAnnotations(javaClass); boolean scopeFound = false; for (Annotation annotation : annotations) { boolean isScope = getAnnotationClass(annotation.annotationType()).isScope(); if (isScope && scopeFound) { // there are at least two scopes, we need to choose one using scope inheritance rules (4.1) return applyScopeInheritanceRules(annotations, javaClass); } if (isScope) { scopeFound = true; } } return annotations; }
@Override public AnnotationClass<?> apply(Class<? extends Annotation> input) { boolean scope = input.isAnnotationPresent(NormalScope.class) || input.isAnnotationPresent(Scope.class) || store.isExtraScope(input); Method repeatableAnnotationAccessor = Annotations.getRepeatableAnnotationAccessor(input); Set<Annotation> metaAnnotations = ImmutableSet.of(internalGetAnnotations(input)); return new AnnotationClassImpl<>(scope, repeatableAnnotationAccessor, metaAnnotations); } }
public static ReflectionCache newInstance(TypeStore store) { if (Reflections.isClassLoadable(HOTSPOT_MARKER, WeldClassLoaderResourceLoader.INSTANCE)) { return new HotspotReflectionCache(store); } else { return new DefaultReflectionCache(store); } } }
public Set<Annotation> applyScopeInheritanceRules(Set<Annotation> annotations, Class<?> javaClass) { ImmutableSet.Builder<Annotation> result = ImmutableSet.builder(); for (Annotation annotation : annotations) { if (!getAnnotationClass(annotation.annotationType()).isScope()) { result.add(annotation); } } result.addAll(findTopLevelScopeDefinitions(javaClass)); return result.build(); }