Class GenericsType.GenericsTypeName

java.lang.Object
org.codehaus.groovy.ast.GenericsType.GenericsTypeName
Enclosing class:
GenericsType

public static class GenericsType.GenericsTypeName extends Object
Represents the name of a GenericsType for use as a map key. Equality and hashing are name-only: that is the JLS 6.4.1 in-scope lookup rule and the JVMS 4.7.9.1 TypeVariableSignature spelling.

Type-variable identity (class T vs method T) lives on GenericsType.getGenericDeclaration(), not on this key. Do not add a declaring class to equals/hashCode: mixed null-owner keys are not an equivalence, and substitution maps that mean "in this scope, name T means String" would stop matching uses.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a generics type name with the specified string.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object that)
    Compares this GenericsTypeName with another object for equality based on the type name.
    Returns the generic type name.
    int
    Returns the hash code based on the type name.
    Returns the string representation of this generics type name.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • GenericsTypeName

      public GenericsTypeName(String name)
      Creates a generics type name with the specified string.
      Parameters:
      name - the generic type name (never null)
      Throws:
      NullPointerException - if name is null
  • Method Details

    • getName

      public String getName()
      Returns the generic type name.
      Returns:
      the name
    • equals

      public boolean equals(Object that)
      Compares this GenericsTypeName with another object for equality based on the type name.
      Overrides:
      equals in class Object
      Parameters:
      that - the object to compare with
      Returns:
      true if both objects are GenericsTypeNames with equal names
    • hashCode

      public int hashCode()
      Returns the hash code based on the type name.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code
    • toString

      public String toString()
      Returns the string representation of this generics type name.
      Overrides:
      toString in class Object
      Returns:
      the name