Package de.xima.fc.interfaces.color
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 eachIGuiColor
of a color palette.- Since:
- 6.5.0
- Author:
- XIMA MEDIA GmbH
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default int
compareTo(IColorField<?> o)
boolean
equals(Object obj)
Implementations MUST make the comparison only with respect togetIdentifier()
.default T
get(IGuiColor color)
Gets the value of this field from the given color.default T
get(IGuiColor color, T defaultValue)
Gets the value of this field from the given color.String
getIdentifier()
int
hashCode()
Implementations MUST calculate the hash code only from thegetIdentifier()
.default boolean
supportedBy(IGuiColor color)
If a sub class overridesget(IGuiColor)
, they should also override this method.
-
-
-
Method Detail
-
compareTo
default int compareTo(IColorField<?> o)
- Specified by:
compareTo
in interfaceComparable<T extends Serializable>
-
equals
boolean equals(Object obj)
Implementations MUST make the comparison only with respect togetIdentifier()
.
-
get
default T get(IGuiColor color) throws IllegalArgumentException
Gets the value of this field from the given color. The default implementation simply defers toIGuiColor.getField(IColorField)
. Sub classes may implement logic, such as computing the value from another field. If you do override this method, also overridesupportedBy(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 toIGuiColor.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 thegetIdentifier()
.
-
supportedBy
default boolean supportedBy(IGuiColor color)
If a sub class overridesget(IGuiColor)
, they should also override this method.- Parameters:
color
- A color to check.- Returns:
- Whether this field supports getting values of the given color.
-
-