Record Class StyleRule<T>
java.lang.Object
java.lang.Record
dev.prozilla.pine.common.property.style.StyleRule<T>
- Type Parameters:
T
- The type of the property- Record Components:
value
- The value this rule assigns to styled properties of elements that match its selector
- All Implemented Interfaces:
Printable
A rule that defines the value of a styled property of any node that matches its selector.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal boolean
Indicates whether some other object is "equal to" this one.int
Returns the specificity of the selector of this rule.final int
hashCode()
Returns a hash code value for this object.boolean
Checks whether this rule applies to a given node.selector()
Returns the value of theselector
record component.toString()
Returns a string representation of this record class.value()
Returns the value of thevalue
record component.
-
Constructor Details
-
StyleRule
Creates an instance of aStyleRule
record class.- Parameters:
selector
- the value for theselector
record componentvalue
- the value for thevalue
record component
-
-
Method Details
-
matches
Checks whether this rule applies to a given node.- Parameters:
node
- The node- Returns:
- True if the selectors of this rule matches the node.
-
getSpecificity
public int getSpecificity()Returns the specificity of the selector of this rule.- Returns:
- The specificity of the selector.
-
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. -
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. -
equals
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 withObjects::equals(Object,Object)
. -
selector
Returns the value of theselector
record component.- Returns:
- the value of the
selector
record component
-
value
Returns the value of thevalue
record component.- Returns:
- the value of the
value
record component
-