java.lang.Object
java.lang.Record
technology.sola.engine.graphics.gui.style.property.Padding
Record Components:
top - the top padding for the element
left - the left padding for the element
bottom - the bottom padding for the element
right - the right padding for the element
All Implemented Interfaces:
MergeableProperty<Padding>

@NullMarked public record Padding(@Nullable Integer top, @Nullable Integer right, @Nullable Integer bottom, @Nullable Integer left) extends Record implements MergeableProperty<Padding>
Padding contains the properties for a GuiElement's padding which is the space between the element's border and content.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Padding
    Padding with all values set to 0.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new Padding instance with no values set.
    Padding(@Nullable Integer size)
    Creates a new Padding instance with all values set to the same.
    Padding(@Nullable Integer topAndBottom, @Nullable Integer leftAndRight)
    Creates a new Padding instance with vertical and horizontal values set.
    Padding(@Nullable Integer top, @Nullable Integer leftAndRight, @Nullable Integer bottom)
    Creates a new Padding instance with top, horizontal, and bottom values set.
    Padding(@Nullable Integer top, @Nullable Integer right, @Nullable Integer bottom, @Nullable Integer left)
    Creates an instance of a Padding record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable Integer
    Returns the value of the bottom record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    @Nullable Integer
    Returns the value of the left record component.
    mergeWith(@Nullable Padding otherProperty)
    Returns a new instance of the property with the resulting values being a merge of the right on top of the left.
    @Nullable Integer
    Returns the value of the right record component.
    @Nullable Integer
    top()
    Returns the value of the top record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

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

    • NONE

      public static final Padding NONE
      Padding with all values set to 0.
  • Constructor Details

    • Padding

      public Padding()
      Creates a new Padding instance with no values set.
    • Padding

      public Padding(@Nullable Integer top, @Nullable Integer leftAndRight, @Nullable Integer bottom)
      Creates a new Padding instance with top, horizontal, and bottom values set.
      Parameters:
      top - the top padding for the element
      leftAndRight - the left and right padding for the element
      bottom - the bottom padding for the element
    • Padding

      public Padding(@Nullable Integer topAndBottom, @Nullable Integer leftAndRight)
      Creates a new Padding instance with vertical and horizontal values set.
      Parameters:
      topAndBottom - the top and bottom padding for the element
      leftAndRight - the left and right padding for the element
    • Padding

      public Padding(@Nullable Integer size)
      Creates a new Padding instance with all values set to the same.
      Parameters:
      size - the value for each side of the padding
    • Padding

      public Padding(@Nullable Integer top, @Nullable Integer right, @Nullable Integer bottom, @Nullable Integer left)
      Creates an instance of a Padding record class.
      Parameters:
      top - the value for the top record component
      right - the value for the right record component
      bottom - the value for the bottom record component
      left - the value for the left record component
  • Method Details

    • mergeWith

      public Padding mergeWith(@Nullable Padding otherProperty)
      Description copied from interface: MergeableProperty
      Returns a new instance of the property with the resulting values being a merge of the right on top of the left.
      Specified by:
      mergeWith in interface MergeableProperty<Padding>
      Parameters:
      otherProperty - the other property object to merge values on top of this one
      Returns:
      a new instance with the merged properties
    • 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.
    • top

      public @Nullable Integer top()
      Returns the value of the top record component.
      Returns:
      the value of the top record component
    • right

      public @Nullable Integer right()
      Returns the value of the right record component.
      Returns:
      the value of the right record component
    • bottom

      public @Nullable Integer bottom()
      Returns the value of the bottom record component.
      Returns:
      the value of the bottom record component
    • left

      public @Nullable Integer left()
      Returns the value of the left record component.
      Returns:
      the value of the left record component