Record Class JsMessage.PlaceholderReference

java.lang.Object
java.lang.Record
com.google.javascript.jscomp.JsMessage.PlaceholderReference
All Implemented Interfaces:
JsMessage.Part
Enclosing class:
JsMessage

public static record JsMessage.PlaceholderReference(String storedPlaceholderName, boolean canonicalFormat) extends Record implements JsMessage.Part
A reference to a placeholder in a translatable message.
  • Constructor Details

    • PlaceholderReference

      public PlaceholderReference(String storedPlaceholderName, boolean canonicalFormat)
      Creates an instance of a PlaceholderReference record class.
      Parameters:
      storedPlaceholderName - the value for the storedPlaceholderName record component
      canonicalFormat - the value for the canonicalFormat record component
  • Method Details

    • getStoredPlaceholderName

      @InlineMe(replacement="this.storedPlaceholderName()") public String getStoredPlaceholderName()
    • isCanonicalFormat

      @InlineMe(replacement="this.canonicalFormat()") public boolean isCanonicalFormat()
    • createForCanonicalName

      public static JsMessage.PlaceholderReference createForCanonicalName(String name)
    • isPlaceholder

      public boolean isPlaceholder()
      Description copied from interface: JsMessage.Part
      True for placeholders, false for literal string parts.
      Specified by:
      isPlaceholder in interface JsMessage.Part
    • getJsPlaceholderName

      public String getJsPlaceholderName()
      Description copied from interface: JsMessage.Part
      Gets the name of the placeholder as it would appear in JS code.

      In JS code placeholders are in lower camel case with zero or more trailing numeric suffixes (e.g. myPlaceholderName_123_456).

      Specified by:
      getJsPlaceholderName in interface JsMessage.Part
      Returns:
      the name for a placeholder
    • getCanonicalPlaceholderName

      public String getCanonicalPlaceholderName()
      Description copied from interface: JsMessage.Part
      Gets the name of the placeholder as it would appear in XMB or XTB files, and also the form it takes when generating message IDs.

      This format is UPPER_SNAKE_CASE.

      Specified by:
      getCanonicalPlaceholderName in interface JsMessage.Part
      Returns:
      the name for a placeholder
    • getString

      public String getString()
      Description copied from interface: JsMessage.Part
      Gets the literal string for this message part.
      Specified by:
      getString in interface JsMessage.Part
      Returns:
      the literal string for JsMessage.StringPart.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • storedPlaceholderName

      public String storedPlaceholderName()
      Returns the value of the storedPlaceholderName record component.
      Returns:
      the value of the storedPlaceholderName record component
    • canonicalFormat

      public boolean canonicalFormat()
      Returns the value of the canonicalFormat record component.
      Returns:
      the value of the canonicalFormat record component