Package dev.nokee.companion
Class ShadowProperty<T>
java.lang.Object
dev.nokee.companion.ShadowProperty<T>
- Type Parameters:
T- the property type
- All Implemented Interfaces:
Callable<T>
Represents an extra property lives in the shadow of read-only getter.
-
Constructor Summary
ConstructorsConstructorDescriptionShadowProperty(Object self, String propertyName, Supplier<T> getter) Constructs a shadow property. -
Method Summary
-
Constructor Details
-
ShadowProperty
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
-
-
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
-
call
Convenience to use inproject.files(shadowProperty)or inproject.provider(shadowProperty). In both cases, the value will be deferred. Note: Must NOT be used during self-assign. -
toString
-