Class PrimitiveType

java.lang.Object
org.jboss.jandex.Type
org.jboss.jandex.PrimitiveType
All Implemented Interfaces:
Descriptor

public final class PrimitiveType extends Type
Represents a primitive Java type. While a set of constants is provided for easy of use, instance equality should not be used to compare to them. Instead equals(Object) should be used.

A primitive is considered equal to another primitive if it specifies the same primitive enumeration value, and contains an equal set of annotation instances.

Author:
Jason T. Greene
Since:
2.0
  • Field Details

  • Method Details

    • kind

      public Type.Kind kind()
      Description copied from class: Type
      Returns the kind of Type this is.
      Specified by:
      kind in class Type
      Returns:
      the kind
    • primitive

      public PrimitiveType.Primitive primitive()
      The type of primitive this primitive type represents
      Returns:
      the primitive
    • asPrimitiveType

      public PrimitiveType asPrimitiveType()
      Description copied from class: Type
      Casts this type to a PrimitiveType and returns it if the kind is Type.Kind.PRIMITIVE. Throws an exception otherwise.
      Overrides:
      asPrimitiveType in class Type
      Returns:
      a PrimitiveType
    • equals

      public boolean equals(Object o)
      Description copied from class: Type
      Compares this Type with another type. A type is equal to another type if it is of the same kind, and all of their fields are equal. This includes annotations, which must be equal as well.
      Overrides:
      equals in class Type
      Parameters:
      o - the type to compare to
      Returns:
      true if equal
      See Also:
    • hashCode

      public int hashCode()
      Description copied from class: Type
      Computes a hash code representing this type.
      Overrides:
      hashCode in class Type
      Returns:
      the hash code