Package dev.nokee.companion
Class ShadowProperty<T>
java.lang.Object
dev.nokee.companion.ShadowProperty<T>
- Type Parameters:
T- the property type
Represents an extra property lives in the shadow of read-only getter.
-
Method Summary
Modifier and TypeMethodDescriptionget()Returns the property's value.Mutate the current property value.static <T> ShadowProperty<T>Constructs a shadow property.voidReplace the property value.voidReplace the property value.toString()
-
Method Details
-
get
Returns the property's value. The shadow (extra properties) are checked first, else it defaults to the plain getter.- Returns:
- the property value
-
set
Replace the property value. Note: the new value will live in the shadow of the original value, make sure everyone knows.- Parameters:
newValue- the new value, must be of the same type as the original value
-
set
Replace the property value. Note: the new value will live in the shadow of the original value, make sure everyone knows.- Parameters:
providedValue- the new deferred value, must be of the same type as the original value
-
mut
Mutate the current property value. Note: the new value will live in the shadow of the original value, make sure everyone knows.- Parameters:
newValueTransformer- the transformer of the current value into the new value- Returns:
- the current shadow property
-
toString
-
of
Constructs a shadow property.- Parameters:
self- the target objectpropertyName- the property name (in terms of Groovy/Kotlin)getter- the plain object getter to the read-only value
-