/** * @return The type of the decorable element. The type of a field or parameter, the return type of a method, the type itself for a type. */ public MetaClass getType() { return decorableType().getType(annotated); }
/** * @return The name of the annotated element. Calls * {@link MetaClassMember#getName()} for fields and methods. The * source code name for parameter, and the simple class name for * types. */ public String getName() { return decorableType().getName(annotated); }
/** * @return The declaring type of the decorable element. If the decorable element is a type, then this returns that type. */ public MetaClass getDecorableDeclaringType() { return decorableType().getEnclosingType(annotated); }
@Override public void configure(IOCProcessingContext context, InjectionContext injectionContext) { injectionContext.mapElementType(WiringElementType.DependentBean, Page.class); }
/** * Get a map of all previously constructed {@link Template} object types */ @SuppressWarnings("unchecked") private Map<MetaClass, BuildMetaClass> getConstructedTemplateTypes(final Decorable decorable) { Map<MetaClass, BuildMetaClass> result = (Map<MetaClass, BuildMetaClass>) decorable.getInjectionContext().getAttribute( CONSTRUCTED_TEMPLATE_SET_KEY); if (result == null) { result = new LinkedHashMap<>(); decorable.getInjectionContext().setAttribute(CONSTRUCTED_TEMPLATE_SET_KEY, result); } return result; }
public Statement call(final Statement... values) { return decorableType().call(annotated, factory, values); }
public boolean isIncluded(final MetaClass type) { return isWhitelisted(type) && !isBlacklisted(type); }
private void runExtensionCallbacks(final Collection<MetaClass> allMetaClasses) { final Collection<ExtensionTypeCallback> extensionCallbacks = injectionContext.getExtensionTypeCallbacks(); extensionCallbacks.forEach(cb -> cb.init()); allMetaClasses.forEach(mc -> extensionCallbacks.forEach(cb -> cb.callback(mc))); extensionCallbacks.forEach(cb -> cb.finish()); }
/** * This should only be called for non-public fields. This method forces a * private accessor to be generated for the field. * * @param field * A field, static or non-static. * @return A statement for accessing the value of a field. */ public ContextualStatementBuilder exposedFieldStmt(final MetaField field) { if (!field.isPublic()) { addExposedField(field); } return DecorableType.FIELD.getAccessStatement(field, factory); }
public boolean isAnyKnownElementType(final HasAnnotations hasAnnotations) { return isAnyOfElementTypes(hasAnnotations, WiringElementType.values()); }
public ContextualStatementBuilder call(final HasAnnotations annotated, final BuildMetaClass factory, Statement... params) { return getAccessStatement(annotated, factory, params); } public String getName(HasAnnotations annotated) {
@Override protected List<Statement> generateFactoryInitStatements(final ClassStructureBuilder<?> bodyBlockBuilder, final Injectable injectable, final DependencyGraph graph, final InjectionContext injectionContext) { return controller.getFactoryInitializaionStatements(); }
public boolean isAnyOfElementTypes(final HasAnnotations hasAnnotations, final WiringElementType... types) { for (final WiringElementType t : types) { if (isElementType(t, hasAnnotations)) return true; } return false; }
@Override public ContextualStatementBuilder getAccessStatement(final HasAnnotations annotated, final BuildMetaClass factory) { return getAccessStatement(annotated, factory, new Statement[0]); }
public static Builder create() { return new Builder(); }
@Override public void configure(final IOCProcessingContext context, final InjectionContext injectionContext) { injectionContext.mapElementType(WiringElementType.DependentBean, Templated.class); }
/** * Get a map of all previously constructed {@link Template} object types */ @SuppressWarnings("unchecked") private Map<MetaClass, BuildMetaClass> getConstructedTemplateTypes(final Decorable decorable) { Map<MetaClass, BuildMetaClass> result = (Map<MetaClass, BuildMetaClass>) decorable.getInjectionContext().getAttribute( CONSTRUCTED_TEMPLATE_SET_KEY); if (result == null) { result = new LinkedHashMap<>(); decorable.getInjectionContext().setAttribute(CONSTRUCTED_TEMPLATE_SET_KEY, result); } return result; }
@Override public void configure(final IOCProcessingContext context, final InjectionContext injectionContext) { injectionContext.mapElementType(WiringElementType.ProducerElement, Produces.class); }
@Override public void configure(IOCProcessingContext context, InjectionContext injectionContext) { injectionContext.mapElementType(WiringElementType.DependentBean, Page.class); }
@Override public void configure(final IOCProcessingContext context, final InjectionContext injectionContext) { injectionContext.mapElementType(WiringElementType.DependentBean, Templated.class); }