Record Class ModelPlaceholder

java.lang.Object
java.lang.Record
kr.toxicity.model.api.data.raw.ModelPlaceholder
Record Components:
variables - a map of placeholder variable names to their string values

public record ModelPlaceholder(@NotNull @Unmodifiable Map<String,String> variables) extends Record
Represents animation variable placeholders defined in a model file.

These placeholders allow for defining reusable values or expressions that can be referenced within Molang scripts in animations.

Since:
1.15.2
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ModelPlaceholder
    An empty placeholder instance with no variables.
    static final com.google.gson.JsonDeserializer<ModelPlaceholder>
    A JSON deserializer for parsing placeholders from a multi-line string.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ModelPlaceholder(@NotNull @Unmodifiable Map<String,String> variables)
    Creates an instance of a ModelPlaceholder record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    @NotNull String
    parseVariable(@NotNull String expression)
    Replaces all placeholder variables in a given expression with their corresponding values.
    final String
    Returns a string representation of this record class.
    @NotNull @Unmodifiable Map<String,String>
    Returns the value of the variables record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • EMPTY

      public static final ModelPlaceholder EMPTY
      An empty placeholder instance with no variables.
      Since:
      1.15.2
    • PARSER

      public static final com.google.gson.JsonDeserializer<ModelPlaceholder> PARSER
      A JSON deserializer for parsing placeholders from a multi-line string.
      Since:
      1.15.2
  • Constructor Details

    • ModelPlaceholder

      public ModelPlaceholder(@NotNull @NotNull @Unmodifiable Map<String,String> variables)
      Creates an instance of a ModelPlaceholder record class.
      Parameters:
      variables - the value for the variables record component
  • Method Details

    • parseVariable

      @NotNull public @NotNull String parseVariable(@NotNull @NotNull String expression)
      Replaces all placeholder variables in a given expression with their corresponding values.
      Parameters:
      expression - the expression containing placeholders
      Returns:
      the expression with placeholders substituted
      Since:
      1.15.2
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • variables

      @NotNull public @NotNull @Unmodifiable Map<String,String> variables()
      Returns the value of the variables record component.
      Returns:
      the value of the variables record component