Interface TypeReference

All Superinterfaces:
CharSequence, Comparable<CharSequence>, Reference
All Known Subinterfaces:
ClassDef, MethodParameter
All Known Implementing Classes:
BaseMethodParameter, BaseTypeReference, BuilderClassDef, BuilderMethodParameter, BuilderTypeReference, ClassDefRewriter.RewrittenClassDef, DexBackedClassDef, DexBackedTypeReference, ImmutableClassDef, ImmutableMethodParameter, ImmutableTypeReference, MethodParameterRewriter.RewrittenMethodParameter, PoolClassDef, ReflectionClassDef, SmaliMethodParameter

public interface TypeReference extends Reference, CharSequence, Comparable<CharSequence>
This class represents a reference to a type. When possible, elsewhere in the interface, a type is referenced directly as a String. A TypeReference is only used in those cases where a generic Reference is needed The type being referenced is represented as a String in the format of a TypeDescriptor, as defined by the dex file specification. This type also acts as a CharSequence wrapper around the TypeDescriptor string. As per the CharSequence contract, calling toString() on a TypeReference yields the type descriptor as a String. This is the same value returned by getType()
  • Method Details

    • getType

      @Nonnull String getType()
      Gets the string representation of the referenced type. The returned string will be a TypeDescriptor, as defined in the dex file specification
      Returns:
      The string representation of the referenced type.
    • hashCode

      int hashCode()
      Returns a hashcode for this TypeReference. This is defined to be getType().hashCode()
      Overrides:
      hashCode in class Object
      Returns:
      The hash code value for this TypeReference
    • equals

      boolean equals(@Nullable Object o)
      Compares this TypeReference to another TypeReference, or more generally to another CharSequence for equality. This TypeReference is equal to a CharSequence iff this.getType().equals(other.toString()). Equivalently, This TypeReference is equal to another TypeReference iff this.getType().equals(other.getType()).
      Overrides:
      equals in class Object
      Parameters:
      o - The object to be compared for equality with this TypeReference
      Returns:
      true if the specified object is equal to this TypeReference
    • compareTo

      int compareTo(@Nonnull CharSequence o)
      Compare this TypeReference to another TypeReference, or more generally to another CharSequence. The comparison is defined to be this.getType().compareTo(other.toString())
      Specified by:
      compareTo in interface Comparable<CharSequence>
      Parameters:
      o - The CharSequence to compare with this TypeReference
      Returns:
      An integer representing the result of the comparison