Class CaptureTypeImpl

  • All Implemented Interfaces:
    CaptureType, java.lang.reflect.Type

    class CaptureTypeImpl
    extends java.lang.Object
    implements CaptureType
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.lang.reflect.Type[] lowerBounds  
      private java.lang.reflect.Type[] upperBounds  
      private java.lang.reflect.TypeVariable<?> variable  
      private java.lang.reflect.WildcardType wildcard  
    • Constructor Summary

      Constructors 
      Constructor Description
      CaptureTypeImpl​(java.lang.reflect.WildcardType wildcard, java.lang.reflect.TypeVariable<?> variable)
      Creates an uninitialized CaptureTypeImpl.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.reflect.Type[] getLowerBounds()
      Returns an array of Type objects representing the lower bound(s) of this type variable.
      java.lang.reflect.TypeVariable<?> getTypeVariable()  
      java.lang.reflect.Type[] getUpperBounds()
      Returns an array of Type objects representing the upper bound(s) of this capture.
      java.lang.reflect.WildcardType getWildcardType()  
      (package private) void init​(VarMap varMap)
      Initialize this CaptureTypeImpl.
      void setUpperBounds​(java.lang.reflect.Type[] upperBounds)
      Overwrite the upper bounds of this capture.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.reflect.Type

        getTypeName
    • Field Detail

      • wildcard

        private final java.lang.reflect.WildcardType wildcard
      • variable

        private final java.lang.reflect.TypeVariable<?> variable
      • lowerBounds

        private final java.lang.reflect.Type[] lowerBounds
      • upperBounds

        private java.lang.reflect.Type[] upperBounds
    • Constructor Detail

      • CaptureTypeImpl

        CaptureTypeImpl​(java.lang.reflect.WildcardType wildcard,
                        java.lang.reflect.TypeVariable<?> variable)
        Creates an uninitialized CaptureTypeImpl. Before using this type, init(VarMap) must be called.
        Parameters:
        wildcard - The wildcard this is a capture of
        variable - The type variable where the wildcard is a parameter for.
    • Method Detail

      • init

        void init​(VarMap varMap)
        Initialize this CaptureTypeImpl. This is needed for type variable bounds referring to each other: we need the capture of the argument.
      • getLowerBounds

        public java.lang.reflect.Type[] getLowerBounds()
        Description copied from interface: CaptureType
        Returns an array of Type objects representing the lower bound(s) of this type variable. This is the bound of a ? super wildcard. This normally contains only one or no types; it is an array for consistency with WildcardType.getLowerBounds().
        Specified by:
        getLowerBounds in interface CaptureType
        Returns:
        lower bound(s) of this capture
      • getUpperBounds

        public java.lang.reflect.Type[] getUpperBounds()
        Description copied from interface: CaptureType
        Returns an array of Type objects representing the upper bound(s) of this capture. This includes both the upper bound of a ? extends wildcard, and the bounds declared with the type variable. References to other (or the same) type variables in bounds coming from the type variable are replaced by their matching capture.
        Specified by:
        getUpperBounds in interface CaptureType
        Returns:
        upper bound(s) of this capture
      • setUpperBounds

        public void setUpperBounds​(java.lang.reflect.Type[] upperBounds)
        Description copied from interface: CaptureType
        Overwrite the upper bounds of this capture. Should not normally be used. When transforming a capture type into its annotated version, it might be necessary to set the upper bounds in a separate step to break an otherwise infinite recursion.
        Specified by:
        setUpperBounds in interface CaptureType
        Parameters:
        upperBounds - upper bound(s) of this capture
      • getTypeVariable

        public java.lang.reflect.TypeVariable<?> getTypeVariable()
        Specified by:
        getTypeVariable in interface CaptureType
        Returns:
        type variable associated to this capture
      • getWildcardType

        public java.lang.reflect.WildcardType getWildcardType()
        Specified by:
        getWildcardType in interface CaptureType
        Returns:
        wildcard type associated to this capture
      • toString

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