if (key.hasAttributes() && !options.exactBindingAnnotationsRequired) { try { Errors ignored = new Errors();
/** * Selects the appropriate qualifying strategy for the given requirement {@link Key}. * * @param key The requirement key * @return Qualifying strategy */ static final QualifyingStrategy selectFor( final Key<?> key ) { final Class<?> qualifierType = key.getAnnotationType(); if ( null == qualifierType ) { return QualifyingStrategy.UNRESTRICTED; } if ( Named.class == qualifierType ) { return key.hasAttributes() ? QualifyingStrategy.NAMED_WITH_ATTRIBUTES : QualifyingStrategy.NAMED; } return key.hasAttributes() ? QualifyingStrategy.MARKED_WITH_ATTRIBUTES : QualifyingStrategy.MARKED; }
private <T> Multibinder<ConfigDefaultsHolder<T>> createConfigDefaultsBinder(Key<T> key) { TypeLiteral<ConfigDefaultsHolder<T>> typeLiteral = getTypeLiteral(key); if (key.getAnnotationType() == null) { return newSetBinder(binder, typeLiteral); } if (key.hasAttributes()) { return newSetBinder(binder, typeLiteral, key.getAnnotation()); } return newSetBinder(binder, typeLiteral, key.getAnnotationType()); }
private <T> Multibinder<ConfigDefaultsHolder<T>> createConfigDefaultsBinder(Key<T> key) { TypeLiteral<ConfigDefaultsHolder<T>> typeLiteral = getTypeLiteral(key); if (key.getAnnotationType() == null) { return newSetBinder(binder, typeLiteral); } if (key.hasAttributes()) { return newSetBinder(binder, typeLiteral, key.getAnnotation()); } return newSetBinder(binder, typeLiteral, key.getAnnotationType()); }
private boolean analyzeDependencies( final Collection<Dependency<?>> dependencies ) { boolean applyBinding = true; for ( final Dependency<?> d : dependencies ) { final Key<?> key = d.getKey(); if ( key.hasAttributes() && "Assisted".equals( key.getAnnotationType().getSimpleName() ) ) { applyBinding = false; // avoid directly binding AssistedInject based components } else { requireKey( key ); } } return applyBinding; }
private <T> Multibinder<ConfigDefaultsHolder<T>> createConfigDefaultsBinder(Key<T> key) { @SuppressWarnings("SerializableInnerClassWithNonSerializableOuterClass") Type type = new TypeToken<ConfigDefaultsHolder<T>>() {} .where(new TypeParameter<T>() {}, (TypeToken<T>) TypeToken.of(key.getTypeLiteral().getType())) .getType(); TypeLiteral<ConfigDefaultsHolder<T>> typeLiteral = (TypeLiteral<ConfigDefaultsHolder<T>>) TypeLiteral.get(type); if (key.getAnnotationType() == null) { return newSetBinder(binder, typeLiteral); } if (key.hasAttributes()) { return newSetBinder(binder, typeLiteral, key.getAnnotation()); } return newSetBinder(binder, typeLiteral, key.getAnnotationType()); } }
@SuppressWarnings("unchecked") @Toolable @javax.inject.Inject protected void initialize(Injector injector) { for (Binding<?> binding : injector.findBindingsByType(advisesType)) { Key<?> bindingKey = binding.getKey(); if (bindingKey.hasAttributes() && AdviceElement.class.isAssignableFrom(bindingKey.getAnnotationType())) { AdviceElementImpl adviceElement = (AdviceElementImpl) bindingKey.getAnnotation(); if (name.equals(adviceElement.name())) { if (adviceElement.type() == AdviceElement.Type.ADVICE) { adviceBindings.add(new ProvisionAdviceHolder<UnaryOperator<T>>((Binding<UnaryOperator<T>>) binding, adviceElement.getOrder())); } dependencies.add(Dependency.get(bindingKey)); } } } adviceBindings.sort(ByOrder); }
static <T> Key<T> getAdvisesKeyForNewItem(Binder binder, Key<T> key) { binder = binder.skipSources(AdvisesBinder.class); Annotation annotation = key.getAnnotation(); String elementName = key.hasAttributes() ? key.getAnnotation().toString() : ""; AdviceElement element = new AdviceElementImpl(elementName, AdviceElement.Type.SOURCE, 0); Key<T> uniqueKey = Key.get(key.getTypeLiteral(), element); // Bind the original key to a new AdvisedProvider binder.bind(key).toProvider(new AdvisedProvider<T>(key.getTypeLiteral(), element.name(), annotation, binder.getProvider(uniqueKey))); return uniqueKey; }
@SuppressWarnings("unchecked") static <T> Key<UnaryOperator<T>> getAdviceKeyForNewItem(Binder binder, Key<T> key, int order) { binder = binder.skipSources(AdvisesBinder.class); String elementName = key.hasAttributes() ? key.getAnnotation().toString() : ""; @SuppressWarnings("unused") Annotation annotation = key.getAnnotation(); Type adviceType = Types.newParameterizedType(UnaryOperator.class, key.getTypeLiteral().getType()); return (Key<UnaryOperator<T>>) Key.get(adviceType, new AdviceElementImpl(elementName, AdviceElement.Type.ADVICE, order)); }
if (key.hasAttributes()) { return getInternalFactory(member, key.withoutAttributes()); if (key.hasAttributes()) { return getInternalFactory(member, key.withoutAttributes()); if (key.hasAttributes()) { return getInternalFactory(member, key.withoutAttributes());
if (key.hasAttributes()) { try { Errors ignored = new Errors();
if (key.hasAttributes() && !options.exactBindingAnnotationsRequired) { try { Errors ignored = new Errors();
if (key.hasAttributes() && !options.exactBindingAnnotationsRequired) { try { Errors ignored = new Errors();
if (key.hasAttributes()) { try { Errors ignored = new Errors();
if (key.hasAttributes()) { try { Errors ignored = new Errors();
if (key.hasAttributes() && !options.exactBindingAnnotationsRequired) { try { Errors ignored = new Errors();