# Interface HasConfigurableValue

All Known Subinterfaces:
  `ConfigurableFileCollection, DirectoryProperty, FileSystemLocationProperty<T>, HasMultipleValues<T>, ListProperty<T>, MapProperty<K,V>, Property<T>, RegularFileProperty, SetProperty<T>`

public interface HasConfigurableValue
Represents an object that holds a value that is configurable, meaning that the value or some source for the value, such as a `Provider`, can be specified directly on the object.

This interface provides methods to manage the lifecycle of the value. Using these methods, the value of the object can be finalized, which means that the value will no longer change. Note that this is not the same as an immutable value. You can think of a finalized value as similar to a `final` variable in Java, so while the value of the variable does not change, the value itself may still be mutable.

When a task property has a value of this type, it will be implicitly finalized when the task starts execution, to prevent accidental changes to the task parameters as the task runs.

Note: This interface is not intended for implementation by build script or plugin authors.

Since:
  5.6

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `disallowChanges()`
  Disallows further direct changes to this object.
  `void`
  `disallowUnsafeRead()`
  Disallows reading the value of this object when its value may not yet be available or may still change.
  `void`
  `finalizeValue()`
  Calculates the final value of this object and disallows further changes to this object.
  `void`
  `finalizeValueOnRead()`
  Requests that the final value of this object be calculated on the next read of the value, if not already known.

- ## Method Details

  - ### finalizeValue

    void finalizeValue()
    Calculates the final value of this object and disallows further changes to this object.

    To calculate the final value of this object any source for the value is queried and the result used as the final value for this object. The source is discarded so that this object no longer tracks the value of the source.

    Subsequent attempts to change the value of this object or to replace the source from which the value is derived will fail with an exception.

    Note that although the value of this object will no longer change, the value may itself be mutable. Calling this method does not guarantee that the value will become immutable, though some implementations may support this.

    If the value of this object is already final, this method does nothing.

    Since:
      5.6

  - ### finalizeValueOnRead

    void finalizeValueOnRead()
    Requests that the final value of this object be calculated on the next read of the value, if not already known.

    Changes to the value of this object or to the source for the value are still permitted until the final value is calculated, after which time attempts to make changes will fail with an exception.

    You can use this method along with `disallowChanges()` to indicate that the value has been configured and that the final value is ready to calculate, without actually calculating the final value until it is required. This can be a useful alternative to `finalizeValue()` for values that are expensive to calculate.

    If the value of this object is already final, this method does nothing.

    Since:
      6.1

  - ### disallowChanges

    void disallowChanges()
    Disallows further direct changes to this object.

    This differs from `finalizeValue()` in that it does not calculate the final value of this object, and so any source for the value will continue to be used until the value is finalized.

    If the value of this object is already final, this method does nothing.

    Since:
      5.6

  - ### disallowUnsafeRead

    void disallowUnsafeRead()
    Disallows reading the value of this object when its value may not yet be available or may still change.

    The value of this property cannot be read during project configuration, to allow all plugins an opportunity to configure the value. After a project's configuration has completed, the value may be read. The property is also finalized on read.

    Since:
      6.4