@SuppressWarnings({ "unchecked", "rawtypes" }) private List<HasAnnotations> getAnnotatedWithForElementType(final MetaClass type, final ElementType elemType, final Class<? extends Annotation> annoType) { final List annotatedItems; switch (elemType) { case FIELD: annotatedItems = type.getFieldsAnnotatedWith(annoType); break; case METHOD: annotatedItems = type.getMethodsAnnotatedWith(annoType); break; case PARAMETER: annotatedItems = type.getParametersAnnotatedWith(annoType); break; case TYPE: annotatedItems = (type.isAnnotationPresent(annoType)) ? Collections.singletonList(type) : Collections.emptyList(); break; default: throw new RuntimeException("Not yet implemented."); } return annotatedItems; }
/** * @param producerInjectable If null then only static fields will be processed. */ private void processProducerFields(final Injectable producerInjectable, final MetaClass producerType, final DependencyGraphBuilder builder, final Collection<MetaMethod> disposesMethods, final boolean enabled, final List<String> problems) { final boolean staticOnly = (producerInjectable == null); final Collection<Class<? extends Annotation>> producerAnnos = injectionContext.getAnnotationsForElementType(WiringElementType.ProducerElement); for (final Class<? extends Annotation> producerAnno : producerAnnos) { final List<MetaField> fields = producerType.getFieldsAnnotatedWith(producerAnno); for (final MetaField field : fields) { if (!staticOnly || field.isStatic()) { processProducerField(producerInjectable, producerType, builder, disposesMethods, field, enabled, problems); } } } }
annotated.addAll(enclosingType.getFieldsAnnotatedWith(annoType));
annotated.addAll(enclosingType.getFieldsAnnotatedWith(annoType));
return false; final List<MetaField> producerFields = type.getFieldsAnnotatedWith(producerAnnoType); if (!producerFields.isEmpty() && producerFields.stream().anyMatch(field -> !field.isStatic())) { return false; if (!type.getFieldsAnnotatedWith(anno).isEmpty()) { return false;
private void addFieldInjectionPoints(final Injectable typeInjectable, final DependencyGraphBuilder builder, final List<String> problems) { final boolean noPublicFieldsAllowed = typeInjectable.getWiringElementTypes().contains(WiringElementType.NormalScopedBean); final MetaClass type = typeInjectable.getInjectedType(); final Collection<Class<? extends Annotation>> injectAnnotations = injectionContext.getAnnotationsForElementType(WiringElementType.InjectionPoint); for (final Class<? extends Annotation> inject : injectAnnotations) { for (final MetaField field : type.getFieldsAnnotatedWith(inject)) { if (noPublicFieldsAllowed && field.isPublic()) { problems.add("The normal scoped bean " + type.getFullyQualifiedName() + " has a public field " + field.getName()); } builder.addFieldDependency(typeInjectable, field.getType(), qualFactory.forSink(field), field); } } }
final List<MetaField> modelFields = decorable.getDecorableDeclaringType().getFieldsAnnotatedWith(Model.class); if (!modelFields.isEmpty()) { throw new GenerationException("Found one or more fields annotated with @Model but missing @Inject "
final List<MetaField> modelFields = decorable.getDecorableDeclaringType().getFieldsAnnotatedWith(Model.class); if (!modelFields.isEmpty()) { throw new GenerationException("Found one or more fields annotated with @Model but missing @Inject "
for (MetaField field : pageClass.getFieldsAnnotatedWith(PageState.class)) { PageState psAnno = field.getAnnotation(PageState.class); String fieldName = field.getName();
for (MetaField field : pageClass.getFieldsAnnotatedWith(PageState.class)) { PageState psAnno = field.getAnnotation(PageState.class); String fieldName = field.getName();