Interface StringReference

All Superinterfaces:
CharSequence, Comparable<CharSequence>, Reference
All Known Implementing Classes:
BaseStringReference, BuilderStringReference, DexBackedStringReference, ImmutableStringReference

public interface StringReference extends Reference, CharSequence, Comparable<CharSequence>
This class represents a reference to an arbitrary string. When possible, elsewhere in the interface, a string is represented directly by its value. A StringReference is only used in those cases where a generic Reference is needed This type also acts as a CharSequence wrapper around the referenced string value. As per the CharSequence contract, calling toString() on a StringReference yields the referenced string value. This is the same value returned by getString().
  • Method Details

    • getString

      @Nonnull String getString()
      Gets the referenced string.
      Returns:
      the referenced string
    • hashCode

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

      boolean equals(@Nullable Object o)
      Compares this StringReference to another CharSequence for equality. String StringReference is equal to a CharSequence iff this.getString().equals(other.toString()). Equivalently, This StringReference is equal to another StringReference iff this.getString().equals(other.getString()).
      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 StringReference to another StringReference, or more generally to another CharSequence. The comparison is defined to be this.getString().compareTo(other.toString()).
      Specified by:
      compareTo in interface Comparable<CharSequence>
      Parameters:
      o - The CharSequence to compare with this StringReference
      Returns:
      An integer representing the result of the comparison