Record Class BlockProperty.Flag

java.lang.Object
java.lang.Record
fr.fidorial.world.block.BlockProperty.Flag
Record Components:
name - the property name
All Implemented Interfaces:
BlockProperty<Boolean>
Enclosing interface:
BlockProperty<T>

public static record BlockProperty.Flag(String name) extends Record implements BlockProperty<Boolean>
A property that is either true or false.
Since:
0.1.0
  • Constructor Details

    • Flag

      public Flag(String name)
      Creates an instance of a Flag record class.
      Parameters:
      name - the value for the name record component
  • Method Details

    • values

      public List<Boolean> values()
      Description copied from interface: BlockProperty
      Returns the accepted values, at least two, in state order.
      Specified by:
      values in interface BlockProperty<Boolean>
      Returns:
      the accepted values, at least two, in state order
    • nameOf

      public String nameOf(Boolean value)
      Description copied from interface: BlockProperty
      Returns the name a value is written as.
      Specified by:
      nameOf in interface BlockProperty<Boolean>
      Parameters:
      value - an accepted value
      Returns:
      the name a value is written as
    • parse

      public @Nullable Boolean parse(String name)
      Description copied from interface: BlockProperty
      Returns the value written as a name, null if none is.
      Specified by:
      parse in interface BlockProperty<Boolean>
      Parameters:
      name - the written value
      Returns:
      the value written as a name, null if none is
    • 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.
    • name

      public String name()
      Returns the value of the name record component.
      Specified by:
      name in interface BlockProperty<Boolean>
      Returns:
      the value of the name record component