Class AbstractBindingBuilder<T>

  • Direct Known Subclasses:
    BindingBuilder, ConstantBindingBuilderImpl

    public abstract class AbstractBindingBuilder<T>
    extends java.lang.Object
    Base class used to create a new binding with the Guice EDSL described in Binder. Constructing an AbstractBindingBuilder will create a new binding and add it into the Binder.
    Author:
    jessewilson@google.com (Jesse Wilson)
    • Field Detail

      • IMPLEMENTATION_ALREADY_SET

        public static final java.lang.String IMPLEMENTATION_ALREADY_SET
        See Also:
        Constant Field Values
      • SINGLE_INSTANCE_AND_SCOPE

        public static final java.lang.String SINGLE_INSTANCE_AND_SCOPE
        See Also:
        Constant Field Values
      • SCOPE_ALREADY_SET

        public static final java.lang.String SCOPE_ALREADY_SET
        See Also:
        Constant Field Values
      • CONSTANT_VALUE_ALREADY_SET

        public static final java.lang.String CONSTANT_VALUE_ALREADY_SET
        See Also:
        Constant Field Values
      • ANNOTATION_ALREADY_SPECIFIED

        public static final java.lang.String ANNOTATION_ALREADY_SPECIFIED
        See Also:
        Constant Field Values
      • NULL_KEY

        protected static final Key<?> NULL_KEY
      • binder

        protected final Binder binder
        The binder that the new binding will be added to.
      • elements

        protected java.util.List<Element> elements
        The list of elements stored inside the binder. The new binding is added to this list.
      • position

        protected int position
        The index of the new binding in elements. This is used by subclasses of AbstractBindingBuilder to repeatedly replace the binding object in elements as more Guice EDSL methods are called to update the binding.
    • Constructor Detail

      • AbstractBindingBuilder

        public AbstractBindingBuilder​(Binder binder,
                                      java.util.List<Element> elements,
                                      java.lang.Object source,
                                      Key<T> key)
    • Method Detail

      • annotatedWithInternal

        protected BindingImpl<T> annotatedWithInternal​(java.lang.Class<? extends java.lang.annotation.Annotation> annotationType)
        Sets the binding to a copy with the specified annotation on the bound key
      • annotatedWithInternal

        protected BindingImpl<T> annotatedWithInternal​(java.lang.annotation.Annotation annotation)
        Sets the binding to a copy with the specified annotation on the bound key
      • in

        public void in​(java.lang.Class<? extends java.lang.annotation.Annotation> scopeAnnotation)
      • in

        public void in​(Scope scope)
      • asEagerSingleton

        public void asEagerSingleton()
      • keyTypeIsSet

        protected boolean keyTypeIsSet()
      • checkNotTargetted

        protected void checkNotTargetted()
      • checkNotAnnotated

        protected void checkNotAnnotated()
      • checkNotScoped

        protected void checkNotScoped()