Search in sources :

Example 11 with Element

use of org.elasticsearch.common.inject.spi.Element in project crate by crate.

the class PrivateElementsImpl method applyTo.

@Override
public void applyTo(Binder binder) {
    PrivateBinder privateBinder = binder.withSource(source).newPrivateBinder();
    for (Element element : getElements()) {
        element.applyTo(privateBinder);
    }
    // ensure exposedKeysToSources is populated
    getExposedKeys();
    for (Map.Entry<Key<?>, Object> entry : exposedKeysToSources.entrySet()) {
        privateBinder.withSource(entry.getValue()).expose(entry.getKey());
    }
}
Also used : PrivateBinder(org.elasticsearch.common.inject.PrivateBinder) Element(org.elasticsearch.common.inject.spi.Element) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) Collections.unmodifiableMap(java.util.Collections.unmodifiableMap) Key(org.elasticsearch.common.inject.Key)

Example 12 with Element

use of org.elasticsearch.common.inject.spi.Element in project crate by crate.

the class AbstractProcessor method process.

public void process(InjectorImpl injector, List<Element> elements) {
    Errors errorsAnyElement = this.errors;
    this.injector = injector;
    try {
        for (Iterator<Element> i = elements.iterator(); i.hasNext(); ) {
            Element element = i.next();
            this.errors = errorsAnyElement.withSource(element.getSource());
            Boolean allDone = element.acceptVisitor(this);
            if (allDone) {
                i.remove();
            }
        }
    } finally {
        this.errors = errorsAnyElement;
        this.injector = null;
    }
}
Also used : Errors(org.elasticsearch.common.inject.internal.Errors) Element(org.elasticsearch.common.inject.spi.Element)

Aggregations

Element (org.elasticsearch.common.inject.spi.Element)12 ProviderInstanceBinding (org.elasticsearch.common.inject.spi.ProviderInstanceBinding)6 InstanceBinding (org.elasticsearch.common.inject.spi.InstanceBinding)4 Map (java.util.Map)3 LinkedKeyBinding (org.elasticsearch.common.inject.spi.LinkedKeyBinding)3 Type (java.lang.reflect.Type)2 Collections.unmodifiableMap (java.util.Collections.unmodifiableMap)2 HashSet (java.util.HashSet)2 LinkedHashMap (java.util.LinkedHashMap)2 Key (org.elasticsearch.common.inject.Key)2 PrivateBinder (org.elasticsearch.common.inject.PrivateBinder)2 Errors (org.elasticsearch.common.inject.internal.Errors)2 HashMap (java.util.HashMap)1 ProviderLookup (org.elasticsearch.common.inject.spi.ProviderLookup)1 UntargettedBinding (org.elasticsearch.common.inject.spi.UntargettedBinding)1