Class Parameter


  • class Parameter
    extends java.lang.Object
    Models a method or constructor parameter.
    • Constructor Summary

      Constructors 
      Constructor Description
      Parameter​(java.lang.reflect.Type type, java.lang.annotation.Annotation[] annotations)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Key<?> fixAnnotations​(Key<?> key)
      Replace annotation instances with annotation types, this is only appropriate for testing if a key is bound and not for injecting.
      private java.lang.annotation.Annotation getBindingAnnotation​(java.lang.annotation.Annotation[] annotations)
      Returns the unique binding annotation from the specified list, or null if there are none.
      private Key<?> getBindingForType​(java.lang.reflect.Type type)  
      (package private) Key<?> getPrimaryBindingKey()  
      private java.lang.reflect.Type getProvidedType​(java.lang.reflect.Type type)  
      java.lang.reflect.Type getType()  
      java.lang.Object getValue​(Injector injector)
      Returns the Guice Key for this parameter.
      private boolean hasAssistedAnnotation​(java.lang.annotation.Annotation[] annotations)  
      boolean isBound​(Injector injector)  
      private boolean isBound​(Injector injector, Key<?> key)  
      boolean isProvidedByFactory()  
      private boolean isProvider​(java.lang.reflect.Type type)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • type

        private final java.lang.reflect.Type type
      • isAssisted

        private final boolean isAssisted
      • bindingAnnotation

        private final java.lang.annotation.Annotation bindingAnnotation
      • isProvider

        private final boolean isProvider
      • provider

        private volatile Provider<? extends java.lang.Object> provider
    • Constructor Detail

      • Parameter

        public Parameter​(java.lang.reflect.Type type,
                         java.lang.annotation.Annotation[] annotations)
    • Method Detail

      • isProvidedByFactory

        public boolean isProvidedByFactory()
      • getType

        public java.lang.reflect.Type getType()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • hasAssistedAnnotation

        private boolean hasAssistedAnnotation​(java.lang.annotation.Annotation[] annotations)
      • getValue

        public java.lang.Object getValue​(Injector injector)
        Returns the Guice Key for this parameter.
      • isBound

        public boolean isBound​(Injector injector)
      • isBound

        private boolean isBound​(Injector injector,
                                Key<?> key)
      • fixAnnotations

        public Key<?> fixAnnotations​(Key<?> key)
        Replace annotation instances with annotation types, this is only appropriate for testing if a key is bound and not for injecting.

        See Guice bug 125, https://github.com/google/guice/issues/125

      • getPrimaryBindingKey

        Key<?> getPrimaryBindingKey()
      • getProvidedType

        private java.lang.reflect.Type getProvidedType​(java.lang.reflect.Type type)
      • isProvider

        private boolean isProvider​(java.lang.reflect.Type type)
      • getBindingForType

        private Key<?> getBindingForType​(java.lang.reflect.Type type)
      • getBindingAnnotation

        private java.lang.annotation.Annotation getBindingAnnotation​(java.lang.annotation.Annotation[] annotations)
        Returns the unique binding annotation from the specified list, or null if there are none.
        Throws:
        java.lang.IllegalStateException - if multiple binding annotations exist.