Class LocalizedString.PlaceholderMetadata

java.lang.Object
com.lokalized.LocalizedString.PlaceholderMetadata
Enclosing class:
LocalizedString

Translator-facing metadata for a single placeholder.

This metadata is informational and is not used by runtime string evaluation. It is intended to improve translator context and to support documentation or linting tools.

Author:
Mark Allen
  • Constructor Details

    • PlaceholderMetadata

      public PlaceholderMetadata(@Nullable String type, @Nullable String commentary, @Nullable String example, @Nullable Set<@NonNull String> allowedValues)
      Constructs placeholder metadata.
      Parameters:
      type - translator-facing type label, for example STRING, NUMBER, or GENDER, may be null
      commentary - commentary describing how the placeholder is used, may be null
      example - example placeholder value, may be null
      allowedValues - allowed values for the placeholder as an insertion-ordered set, may be null
  • Method Details

    • toString

      Generates a String representation of this object.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this object, not null
    • equals

      public boolean equals(@Nullable Object other)
      Checks if this object is equal to another one.
      Overrides:
      equals in class Object
      Parameters:
      other - the object to check, null returns false
      Returns:
      true if this is equal to the other object, false otherwise
    • hashCode

      public int hashCode()
      A hash code for this object.
      Overrides:
      hashCode in class Object
      Returns:
      a suitable hash code
    • getType

      Gets the translator-facing type label for this placeholder.
      Returns:
      the translator-facing type label for this placeholder, not null
    • getCommentary

      Gets the commentary for this placeholder.
      Returns:
      the commentary for this placeholder, not null
    • getExample

      Gets an example value for this placeholder.
      Returns:
      an example value for this placeholder, not null
    • getAllowedValues

      Gets the allowed values for this placeholder.
      Returns:
      the allowed values for this placeholder, not null