Class ShadowProperty<T>

java.lang.Object
dev.nokee.companion.ShadowProperty<T>
Type Parameters:
T - the property type

public abstract class ShadowProperty<T> extends Object
Represents an extra property lives in the shadow of read-only getter.
  • Method Details

    • get

      public T 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

      public void set(T newValue)
      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

      public void set(org.gradle.api.provider.Provider<? extends T> providedValue)
      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

      public ShadowProperty<T> mut(org.gradle.api.Transformer<T,T> newValueTransformer)
      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

      public String toString()
      Overrides:
      toString in class Object
    • of

      public static <T> ShadowProperty<T> of(Object self, String propertyName, Supplier<T> getter)
      Constructs a shadow property.
      Parameters:
      self - the target object
      propertyName - the property name (in terms of Groovy/Kotlin)
      getter - the plain object getter to the read-only value