Class GuiStyleToken<T>
java.lang.Object
com.render.api.gui.style.GuiStyleToken<T>
- Type Parameters:
T- property value type
Shared, typed design value for modern GUI and managed HUD declarations.
Read and mutate tokens on the client thread. Bound declarations retain the token, rather than a value snapshot. Changing a token invalidates its attached sheets and inline components. Ordinary property inheritance and transitions then apply to the newly resolved value. A token never retains its subscribing views strongly.
-
Method Summary
Modifier and TypeMethodDescriptionname()observe(GuiStyleProperty<T> property, Runnable changed) Observes a live property binding.static <T> GuiStyleToken<T> of(String name, GuiStyleProperty<T> definition, T value) Creates a token using a property's type, validation, and defensive copying rules.longrevision()Validates and publishes a value.voidvalidateBinding(GuiStyleProperty<T> property) Validates a binding without registering an observer.value()
-
Method Details
-
of
Creates a token using a property's type, validation, and defensive copying rules.- Type Parameters:
T- value type- Parameters:
name- diagnostic name; token identity, rather than name, determines sharingdefinition- property defining the value contractvalue- initial value- Returns:
- new token
-
name
- Returns:
- diagnostic name
-
value
- Returns:
- detached current value
-
revision
public long revision()- Returns:
- monotonic value revision
-
set
Validates and publishes a value. All live bindings validate before any value changes or notification occurs. Equal values are a no-op. Several token changes before the next host synchronization resolve in one pass. Observer failures are rethrown after every remaining live observer has been notified; the value stays published.- Parameters:
next- new value- Returns:
- this token
-
validateBinding
Validates a binding without registering an observer. Compatible properties may share a token, for example several spacing properties accepting the same float value.- Parameters:
property- target property
-
observe
Observes a live property binding. Retain the returned handle while the binding is active; the token holds only a weak reference. Closing it stops notifications and releases that target's validation requirement.- Parameters:
property- target propertychanged- callback on a changed value- Returns:
- binding registration
-