Interface IColorField<T extends Serializable>

Type Parameters:
T - Type of the property value.
All Superinterfaces:
Comparable<IColorField<?>>, Serializable
All Known Implementing Classes:
ColorField

public interface IColorField<T extends Serializable> extends Serializable, Comparable<IColorField<?>>
Represents a field supported by each IGuiColor of a color palette.
Since:
6.5.0
Author:
XIMA MEDIA GmbH
  • Method Details

    • compareTo

      default int compareTo(IColorField<?> o)
      Specified by:
      compareTo in interface Comparable<T extends Serializable>
    • equals

      boolean equals(Object obj)
      Implementations MUST make the comparison only with respect to getIdentifier().
      Overrides:
      equals in class Object
      Parameters:
      obj - Other object to compare this object to.
      Returns:
      Whether this object equals the given object.
    • get

      default T get(IGuiColor color) throws IllegalArgumentException
      Gets the value of this field from the given color. The default implementation simply defers to IGuiColor.getField(IColorField). Sub classes may implement logic, such as computing the value from another field. If you do override this method, also override supportedBy(IGuiColor).
      Parameters:
      color - Color from which to get the value.
      Returns:
      The value of this field.
      Throws:
      IllegalArgumentException - When this field is not supported by the given color.
    • get

      default T get(IGuiColor color, T defaultValue)
      Gets the value of this field from the given color. The default implementation simply defers to IGuiColor.getField(IColorField). Sub classes may implement logic, such as computing the value from another field.
      Parameters:
      color - Color from which to get the value.
      defaultValue - Value to return when this field is not supported by the given color.
      Returns:
      The value of this field.
    • getIdentifier

      String getIdentifier()
      Returns:
      Unique identifier of this color field.
    • hashCode

      int hashCode()
      Implementations MUST calculate the hash code only from the getIdentifier().
      Overrides:
      hashCode in class Object
      Returns:
      The hash code of this object.
    • supportedBy

      default boolean supportedBy(IGuiColor color)
      If a sub class overrides get(IGuiColor), they should also override this method.
      Parameters:
      color - A color to check.
      Returns:
      Whether this field supports getting values of the given color.