Class CaptureTypeImpl

java.lang.Object
io.leangen.geantyref.CaptureTypeImpl
All Implemented Interfaces:
CaptureType, Type

class CaptureTypeImpl extends Object implements CaptureType
  • Field Details

    • wildcard

      private final WildcardType wildcard
    • variable

      private final TypeVariable<?> variable
    • lowerBounds

      private final Type[] lowerBounds
    • upperBounds

      private Type[] upperBounds
  • Constructor Details

    • CaptureTypeImpl

      CaptureTypeImpl(WildcardType wildcard, 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 Details

    • 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 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 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(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 TypeVariable<?> getTypeVariable()
      Specified by:
      getTypeVariable in interface CaptureType
      Returns:
      type variable associated to this capture
    • getWildcardType

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

      public String toString()
      Overrides:
      toString in class Object