Record Class TextComponent
java.lang.Object
java.lang.Record
nl.pim16aap2.animatedarchitecture.core.text.TextComponent
- Record Components:
decorators- A list of decorators that may be used to add additional decorations to text components. Note that such decorations are entirely optional. The renderer used for rendering the text is free to determine which decorates are supported.
Represents a component in a piece of text that has zero or more
ITextDecorator to add features such as colors
or clickable links, etc.-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TextComponentText component that does not contain any decorators. -
Constructor Summary
ConstructorsConstructorDescriptionTextComponent(List<ITextDecorator> decorators) Creates an instance of aTextComponentrecord class.TextComponent(ITextDecorator... decorators) -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thedecoratorsrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.withDecorators(List<ITextDecorator> append) Creates a new text component with additional decorators.withDecorators(ITextDecorator... append) Creates a new text component with additional decorators.
-
Field Details
-
EMPTY
Text component that does not contain any decorators.
-
-
Constructor Details
-
TextComponent
Creates an instance of aTextComponentrecord class.- Parameters:
decorators- the value for thedecoratorsrecord component
-
TextComponent
-
TextComponent
public TextComponent()
-
-
Method Details
-
withDecorators
Creates a new text component with additional decorators.- Parameters:
append- The decorators to append.- Returns:
- The new text component.
-
withDecorators
Creates a new text component with additional decorators.- Parameters:
append- The decorators to append.- Returns:
- The new text component.
-
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). -
decorators
Returns the value of thedecoratorsrecord component.- Returns:
- the value of the
decoratorsrecord component
-