com.hammurapi.common.concurrent

## Interface PropertySet<KP>

- Type Parameters:
    `KP` - Key path.
  All Superinterfaces:
    Adaptable, Versionable<PropertySet<KP>>
  All Known Implementing Classes:
    AbstractPropertySet, AbstractSubSet, LocalAbstractPropertySet, LocalStringPropertySet, StringSubSet

      public interface PropertySet<KP>
      extends Adaptable, Versionable<PropertySet<KP>>

  Online documentation

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cancel(KP key)` Removes callable to be cooked from the cooking queue, converting it to lazy, if it is not already cooked.
    `void` | `cancelAll()` Cancels all unfinished background computations.
    `void` | `clear()` Removes all entries from the property set
    `void` | `cook(KP key, Callable<?> callable)` Puts callable to the property set for asynchronous invocation to retrieve value at some point in the future.
    `void` | `cook(KP key, Callable<?> callable, long delay, TimeUnit timeUnit)` Puts callable to the property set for asynchronous invocation to retrieve value at some point in the future after specified delay.
    `void` | `cooking(KP key, Future<?> future)` Puts value which is not ready yet but "is being cooked by another thread" to the property set to be used at some point of time in the future.
    `Object` | `get(KP key)` Retrieves property without conversion.
    `<T> T` | `get(KP key, Class<T> type)` Retrieves property with conversion to target type.
    `<T> T` | `get(KP key, Class<T> type, long timeout, TimeUnit unit)` Retrieves property with conversion to target type.
    `<T> T` | `get(KP key, Class<T> type, T defaultValue)`
    `<T> T` | `get(KP key, Class<T> type, T defaultValue, long timeout, TimeUnit unit)`
    `Object` | `get(KP key, long timeout, TimeUnit unit)` Retrieves property without conversion.
    `Object` | `get(KP key, Object defaultValue)`
    `Object` | `get(KP key, Object defaultValue, long timeout, TimeUnit unit)`
    `Object` | `invoke(KP key, Object... args)` Invokes invocable at given key.
    `Set<KP>` | `keySet()`
    `void` | `lazy(KP key, Callable<?> callable)` Puts callable to the property set.
    `void` | `mount(KP prefix, PropertySet<KP> source)` Mounts source property set at specified prefix.
    `void` | `remove(KP key)` Removes property from the set.
    `void` | `set(KP key, Object value)` Sets property.
    `void` | `setAll(PropertySet<KP> source)` Copies all entries from the source property set to self.
    `void` | `setInvocable(KP key, Invocable<PropertySet<KP>,?,KP,?> invocable)` Convenience method to set invocable.
    `Object` | `shadowGet(KP key)` Retrieves shadow property without conversion.
    `<T> T` | `shadowGet(KP key, Class<T> type)` Retrieves property with conversion to target type.
    `<T> T` | `shadowGet(KP key, Class<T> type, long timeout, TimeUnit unit)` Retrieves property with conversion to target type.
    `<T> T` | `shadowGet(KP key, Class<T> type, T defaultValue)`
    `<T> T` | `shadowGet(KP key, Class<T> type, T defaultValue, long timeout, TimeUnit unit)`
    `Object` | `shadowGet(KP key, long timeout, TimeUnit unit)` Retrieves shadow property without conversion.
    `Object` | `shadowGet(KP key, Object defaultValue)`
    `Object` | `shadowGet(KP key, Object defaultValue, long timeout, TimeUnit unit)`
    `Object` | `shadowInvoke(KP key, Object... args)` Invokes invocable in the shadow property set at given key.
    `PropertySet<KP>` | `subset(KP prefix)`
    `void` | `unmount(KP prefix)`

    - ### Methods inherited from interface com.hammurapi.common.Adaptable

      `getAdapter`

    - ### Methods inherited from interface com.hammurapi.common.concurrent.Versionable

      `createVersion`

- - ### Method Detail

    - #### keySet

          Set<KP> keySet()

      Returns:
        Names of properties in the set

    - #### subset

          PropertySet<KP> subset(KP prefix)

      Parameters:
        `prefix` -
      Returns:
        Property set which operates on properties starting with given prefix.

    - #### remove

          void remove(KP key)

      Removes property from the set. Chained properties are shadowed (appear to be removed).
      Parameters:
        `name` -

    - #### clear

          void clear()

      Removes all entries from the property set

    - #### mount

          void mount(KP prefix,
                   PropertySet<KP> source)

      Mounts source property set at specified prefix. E.g. if source property set has entry 'a' and prefix is 'b/' then that entry will be available as 'b/a'. Mounted entries shadow own entries.
      Parameters:
        `prefix` -
        `source` -

    - #### unmount

          void unmount(KP prefix)

    - #### setAll

          void setAll(PropertySet<KP> source)

      Copies all entries from the source property set to self.
      Parameters:
        `source` -

    - #### get

          Object get(KP key)

      Retrieves property without conversion.

    - #### get

          Object get(KP key,
                   Object defaultValue)

      Parameters:
        `key` - Property key.
        `defaultValue` - Default value.
      Returns:
        Property value or default value if property doesn't exist in the property set.

    - #### get

          <T> T get(KP key,
                  Class<T> type)

      Retrieves property with conversion to target type.

    - #### get

          <T> T get(KP key,
                  Class<T> type,
                  T defaultValue)

      Parameters:
        `key` - Property key.
        `type` - target type.
        `defaultValue` - Default value.
      Returns:
        Property value or default value if property doesn't exist in the property set.

    - #### get

          Object get(KP key,
                   long timeout,
                   TimeUnit unit)

      Retrieves property without conversion.

    - #### get

          Object get(KP key,
                   Object defaultValue,
                   long timeout,
                   TimeUnit unit)

      Parameters:
        `key` - Property key.
        `defaultValue` - Default value.
      Returns:
        Property value or default value if property doesn't exist in the property set.

    - #### get

          <T> T get(KP key,
                  Class<T> type,
                  long timeout,
                  TimeUnit unit)

      Retrieves property with conversion to target type.

    - #### get

          <T> T get(KP key,
                  Class<T> type,
                  T defaultValue,
                  long timeout,
                  TimeUnit unit)

      Parameters:
        `key` - Property key.
        `type` - target type.
        `defaultValue` - Default value.
      Returns:
        Property value or default value if property doesn't exist in the property set.

    - #### set

          void set(KP key,
                 Object value)

      Sets property.
      Parameters:
        `key` -
        `value` -

    - #### setInvocable

          void setInvocable(KP key,
                          Invocable<PropertySet<KP>,?,KP,?> invocable)

      Convenience method to set invocable.
      Parameters:
        `key` -
        `invocable` -

    - #### cook

          void cook(KP key,
                  Callable<?> callable)

      Puts callable to the property set for asynchronous invocation to retrieve value at some point in the future.
      Parameters:
        `name` -
        `callable` -

    - #### cook

          void cook(KP key,
                  Callable<?> callable,
                  long delay,
                  TimeUnit timeUnit)

      Puts callable to the property set for asynchronous invocation to retrieve value at some point in the future after specified delay.
      Parameters:
        `name` -
        `callable` -
        `delay` -

    - #### cooking

          void cooking(KP key,
                     Future<?> future)

      Puts value which is not ready yet but "is being cooked by another thread" to the property set to be used at some point of time in the future.
      Parameters:
        `name` -
        `future` - Value being cooked.

    - #### lazy

          void lazy(KP key,
                  Callable<?> callable)

      Puts callable to the property set. Value from callable is retrieved when `get()` method for the given name is invoked.
      Parameters:
        `name` -
        `callable` -

    - #### cancel

          void cancel(KP key)

      Removes callable to be cooked from the cooking queue, converting it to lazy, if it is not already cooked.
      Parameters:
        `name` -

    - #### cancelAll

          void cancelAll()

      Cancels all unfinished background computations.

    - #### invoke

          Object invoke(KP key,
                      Object... args)

      Invokes invocable at given key. Converts arguments to proper types if needed. Invocation is performed under the write lock, so the invocable can safely modify the property set.

    - #### shadowInvoke

          Object shadowInvoke(KP key,
                            Object... args)

      Invokes invocable in the shadow property set at given key. Converts arguments to proper types if needed. The shadow invocable is provided a read-only property set as a context and thus any attempt to modify the state of shadow property set(s) will result in exception.

    - #### shadowGet

          Object shadowGet(KP key)

      Retrieves shadow property without conversion.

    - #### shadowGet

          Object shadowGet(KP key,
                         Object defaultValue)

      Parameters:
        `key` - Property key.
        `defaultValue` - Default value.
      Returns:
        Property value or default value if property doesn't exist in the property set.

    - #### shadowGet

          <T> T shadowGet(KP key,
                        Class<T> type)

      Retrieves property with conversion to target type.

    - #### shadowGet

          <T> T shadowGet(KP key,
                        Class<T> type,
                        T defaultValue)

      Parameters:
        `key` - Property key.
        `type` - target type.
        `defaultValue` - Default value.
      Returns:
        Property value or default value if property doesn't exist in the property set.

    - #### shadowGet

          Object shadowGet(KP key,
                         long timeout,
                         TimeUnit unit)

      Retrieves shadow property without conversion.

    - #### shadowGet

          Object shadowGet(KP key,
                         Object defaultValue,
                         long timeout,
                         TimeUnit unit)

      Parameters:
        `key` - Property key.
        `defaultValue` - Default value.
      Returns:
        Property value or default value if property doesn't exist in the property set.

    - #### shadowGet

          <T> T shadowGet(KP key,
                        Class<T> type,
                        long timeout,
                        TimeUnit unit)

      Retrieves property with conversion to target type.

    - #### shadowGet

          <T> T shadowGet(KP key,
                        Class<T> type,
                        T defaultValue,
                        long timeout,
                        TimeUnit unit)

      Parameters:
        `key` - Property key.
        `type` - target type.
        `defaultValue` - Default value.
      Returns:
        Property value or default value if property doesn't exist in the property set.