Class MemberRef

java.lang.Object
org.stianloader.remapper.MemberRef

public final class MemberRef extends Object
A reference to a class member (which can be a field or a method). Note that stianloader-remapper does not mandate that the member exists and may refer to a member that exists in a superclass or even not at all.

For all intents and purposes this class is just a tuple of an owner, name and descriptor.

This class implements hashCode() and equals(Object) and can thus be used in hashtable-based structures such as the key of an HashMap.

Instances of this class are immutable.

  • Constructor Details

    • MemberRef

      public MemberRef(@NotNull @NotNull String owner, @NotNull @NotNull String name, @NotNull @NotNull String desc)
      Constructor. All class names are represented using the internal name of the class - so forward slashes instead of dots.
      Parameters:
      owner - The owner of the member (not necessarily the class that defines the member)
      name - The name of the member
      desc - The descriptor of the member
  • Method Details

    • equals

      @Contract(pure=true) public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getDesc

      @NotNull @Contract(pure=true) public @NotNull String getDesc()
      Obtains the descriptor of the member.

      For methods, the first character of the descriptor will be '(', if the first character is something else, it is a field.

      Returns:
      The descriptor of the member
    • getName

      @NotNull @Contract(pure=true) public @NotNull String getName()
      Obtains the name of the member.

      This class does not define in which namespace the name is, it depends on the context in which the MemberRef is being used in.

      Returns:
      The name of the member.
    • getOwner

      @NotNull @Contract(pure=true) public @NotNull String getOwner()
      Obtains the owner of the member reference, represented via the the internal name of the class.
      Returns:
      The owner of the member reference
    • hashCode

      @Contract(pure=true) public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      @NotNull @Contract(pure=true) public @NotNull String toString()
      Overrides:
      toString in class Object