Class JTypeVar

All Implemented Interfaces:
JDeclaration, JGenerable, Comparable<JType>

public final class JTypeVar extends JClass implements JDeclaration
Type variable used to declare generics.
Author:
Kohsuke Kawaguchi ([email protected])
See Also:
  • Method Details

    • name

      public String name()
      Description copied from class: JClass
      Gets the name of this class.
      Specified by:
      name in class JClass
      Returns:
      name of this class, without any qualification. For example, this method returns "String" for java.lang.String.
    • fullName

      public String fullName()
      Description copied from class: JType
      Gets the full name of the type. See http://java.sun.com/docs/books/jls/second_edition/html/names.doc.html#25430 for the details.
      Specified by:
      fullName in class JType
      Returns:
      Strings like "int", "java.lang.String", "java.io.File[]". Never null.
    • _package

      public JPackage _package()
      Description copied from class: JClass
      Gets the package to which this class belongs. TODO: shall we move move this down?
      Specified by:
      _package in class JClass
    • bound

      public JTypeVar bound(JClass c)
      Adds a bound to this variable.
      Returns:
      this
    • bound

      public JClass bound()
      Returns:
      bound of this variable
    • _extends

      public JClass _extends()
      Returns the class bound of this variable.

      If no bound is given, this method returns Object.

      Specified by:
      _extends in class JClass
      Returns:
      Returns the JClass representing the superclass of the entity (class or interface) represented by this . Even if no super class is given explicitly or this is not a class, this method still returns for Object. If this JClass represents Object, return null.
    • _implements

      public Iterator<JClass> _implements()
      Returns the interface bounds of this variable.
      Specified by:
      _implements in class JClass
      Returns:
      A non-null valid iterator that iterates all objects that represents those interfaces implemented by this object.
    • isInterface

      public boolean isInterface()
      Description copied from class: JClass
      Checks if this object represents an interface.
      Specified by:
      isInterface in class JClass
    • isAbstract

      public boolean isAbstract()
      Description copied from class: JClass
      Checks if this class is an abstract class.
      Specified by:
      isAbstract in class JClass
    • declare

      public void declare(JFormatter f)
      Prints out the declaration of the variable.
      Specified by:
      declare in interface JDeclaration
    • substituteParams

      protected JClass substituteParams(JTypeVar[] variables, List<JClass> bindings)
      Description copied from class: JClass
      Substitutes the type variables with their actual arguments.

      For example, when this class is Map<String,Map<V>>, (where V then doing substituteParams( V, Integer ) returns a for Map<String,Map<Integer>>.

      This method needs to work recursively.

      Specified by:
      substituteParams in class JClass
    • generate

      public void generate(JFormatter f)
      Specified by:
      generate in interface JGenerable
      Overrides:
      generate in class JClass