Class WildcardKey


  • final class WildcardKey
    extends java.lang.Object
    Binding Key for implementations that act as "wild-cards", meaning they match against any assignable type.

    Since the wild-card type is Object and the associated qualifier may not be unique between implementations, the qualifier is saved and replaced with a unique (per-implementation) pseudo-qualifier. The original qualifier is available by casting the pseudo-qualifier to Provider and calling get().

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static interface  WildcardKey.Qualified
      Qualifier that captures a qualified implementation type.
      private static class  WildcardKey.QualifiedImpl
      Pseudo-Annotation that can wrap any implementation type as a Qualifier.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static com.google.inject.TypeLiteral<java.lang.Object> OBJECT_TYPE_LITERAL  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private WildcardKey()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static com.google.inject.Key<java.lang.Object> get​(java.lang.Class<?> type, java.lang.annotation.Annotation qualifier)  
      • Methods inherited from class java.lang.Object

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

      • OBJECT_TYPE_LITERAL

        private static final com.google.inject.TypeLiteral<java.lang.Object> OBJECT_TYPE_LITERAL
    • Constructor Detail

      • WildcardKey

        private WildcardKey()
    • Method Detail

      • get

        public static com.google.inject.Key<java.lang.Object> get​(java.lang.Class<?> type,
                                                                  java.lang.annotation.Annotation qualifier)
        Returns:
        Wildcard key for the given implementation type and qualifier