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 each
IGuiColor
of a color palette.- Since:
- 6.5.0
- Author:
- XIMA MEDIA GmbH
-
Method Summary
Modifier and TypeMethodDescriptiondefault int
compareTo
(IColorField<?> o) boolean
Implementations MUST make the comparison only with respect togetIdentifier()
.default T
Gets the value of this field from the given color.default T
Gets the value of this field from the given color.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 Details
-
compareTo
- Specified by:
compareTo
in interfaceComparable<T extends Serializable>
-
equals
Implementations MUST make the comparison only with respect togetIdentifier()
. -
get
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
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
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.
-