Interface Generics

  • All Known Implementing Classes:
    DefaultGenerics, NoGenerics

    public interface Generics
    Handles storage of generic type information
    • Method Detail

      • nextGenericTypes

        Generics.GenericType[] nextGenericTypes()
        Returns the current type parameters and pushes the next level of type parameters for subsequent calls. Must be balanced by popGenericType() (optional if null is returned). If multiple type parameters are returned, the last is used to advance to the next level of type parameters.

        nextGenericClass() is easier to use when a class has a single type parameter. When a class has multiple type parameters, pushGenericType(GenericType) must be used for all except the last parameter.

        Returns:
        May be null.
      • nextGenericClass

        Class nextGenericClass()
        Resolves the first type parameter and returns the class, or null if it could not be resolved or there are no type parameters. Uses nextGenericTypes(), so must be balanced by popGenericType() (optional if null is returned).

        This method is intended for ease of use when a class has a single type parameter.

        Returns:
        May be null.
      • pushTypeVariables

        int pushTypeVariables​(Generics.GenericsHierarchy hierarchy,
                              Generics.GenericType[] args)
        Stores the types of the type parameters for the specified class hierarchy. Must be balanced by popTypeVariables(int) if >0 is returned.
        Parameters:
        args - May contain null for type arguments that aren't known.
        Returns:
        The number of entries that were pushed.
      • resolveTypeVariable

        Class resolveTypeVariable​(TypeVariable typeVariable)
        Returns the class for the specified type variable, or null if it is not known.
        Returns:
        May be null.
      • getGenericTypesSize

        int getGenericTypesSize()
        Returns the number of generic types currently tracked