com.hammurapi.common.concurrent

## Class AbstractSubSet<KP>

- java.lang.Object
- - com.hammurapi.common.concurrent.AbstractSubSet<KP>

- All Implemented Interfaces:
    Adaptable, PropertySet<KP>, Versionable<PropertySet<KP>>
  Direct Known Subclasses:
    StringSubSet

      public abstract class AbstractSubSet<KP>
      extends Object
      implements PropertySet<KP>

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `AbstractSubSet(PropertySet<KP> master, KP prefix)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract KP` | `buildPath(KP prefix, KP key)`
    `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.
    `PropertySet<KP>` | `createVersion()` Creates object version.
    `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)`
    `<T> T` | `getAdapter(Class<T> targetType, Context context)` Retrieves adapter of given type from adaptable.
    `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 class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractSubSet

          protected AbstractSubSet(PropertySet<KP> master,
                        KP prefix)

  - ### Method Detail

    - #### buildPath

          protected abstract KP buildPath(KP prefix,
                     KP key)

    - #### clear

          public void clear()

      Description copied from interface: `PropertySet`
      Removes all entries from the property set
      Specified by:
        `clear` in interface `PropertySet<KP>`

    - #### get

          public Object get(KP key)

      Description copied from interface: `PropertySet`
      Retrieves property without conversion.
      Specified by:
        `get` in interface `PropertySet<KP>`

    - #### get

          public Object get(KP key,
                   Object defaultValue)

      Specified by:
        `get` in interface `PropertySet<KP>`
      Parameters:
        `key` - Property key.
        `defaultValue` - Default value.
      Returns:
        Property value or default value if property doesn't exist in the property set.

    - #### get

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

      Description copied from interface: `PropertySet`
      Retrieves property with conversion to target type.
      Specified by:
        `get` in interface `PropertySet<KP>`

    - #### get

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

      Specified by:
        `get` in interface `PropertySet<KP>`
      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

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

      Description copied from interface: `PropertySet`
      Retrieves property without conversion.
      Specified by:
        `get` in interface `PropertySet<KP>`

    - #### get

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

      Specified by:
        `get` in interface `PropertySet<KP>`
      Parameters:
        `key` - Property key.
        `defaultValue` - Default value.
      Returns:
        Property value or default value if property doesn't exist in the property set.

    - #### get

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

      Description copied from interface: `PropertySet`
      Retrieves property with conversion to target type.
      Specified by:
        `get` in interface `PropertySet<KP>`

    - #### get

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

      Specified by:
        `get` in interface `PropertySet<KP>`
      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.

    - #### cook

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

      Description copied from interface: `PropertySet`
      Puts callable to the property set for asynchronous invocation to retrieve value at some point in the future.
      Specified by:
        `cook` in interface `PropertySet<KP>`

    - #### cook

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

      Description copied from interface: `PropertySet`
      Puts callable to the property set for asynchronous invocation to retrieve value at some point in the future after specified delay.
      Specified by:
        `cook` in interface `PropertySet<KP>`

    - #### cooking

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

      Description copied from interface: `PropertySet`
      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.
      Specified by:
        `cooking` in interface `PropertySet<KP>`
        `future` - Value being cooked.

    - #### cancel

          public void cancel(KP key)

      Description copied from interface: `PropertySet`
      Removes callable to be cooked from the cooking queue, converting it to lazy, if it is not already cooked.
      Specified by:
        `cancel` in interface `PropertySet<KP>`

    - #### cancelAll

          public void cancelAll()

      Description copied from interface: `PropertySet`
      Cancels all unfinished background computations.
      Specified by:
        `cancelAll` in interface `PropertySet<KP>`

    - #### getAdapter

          public <T> T getAdapter(Class<T> targetType,
                         Context context)

      Description copied from interface: `Adaptable`
      Retrieves adapter of given type from adaptable.
      Specified by:
        `getAdapter` in interface `Adaptable`
      Type Parameters:
        `T` - Adapter type.
      Parameters:
        `targetType` - Adapter type.
        `context` - Adapter context.
      Returns:
        Adapter or null if adapter type is not supported.

    - #### keySet

          public Set<KP> keySet()

      Specified by:
        `keySet` in interface `PropertySet<KP>`
      Returns:
        Names of properties in the set

    - #### subset

          public PropertySet<KP> subset(KP prefix)

      Specified by:
        `subset` in interface `PropertySet<KP>`
      Returns:
        Property set which operates on properties starting with given prefix.

    - #### remove

          public void remove(KP key)

      Description copied from interface: `PropertySet`
      Removes property from the set. Chained properties are shadowed (appear to be removed).
      Specified by:
        `remove` in interface `PropertySet<KP>`

    - #### mount

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

      Description copied from interface: `PropertySet`
      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.
      Specified by:
        `mount` in interface `PropertySet<KP>`

    - #### unmount

          public void unmount(KP prefix)

      Specified by:
        `unmount` in interface `PropertySet<KP>`

    - #### setAll

          public void setAll(PropertySet<KP> source)

      Description copied from interface: `PropertySet`
      Copies all entries from the source property set to self.
      Specified by:
        `setAll` in interface `PropertySet<KP>`

    - #### set

          public void set(KP key,
                 Object value)

      Description copied from interface: `PropertySet`
      Sets property.
      Specified by:
        `set` in interface `PropertySet<KP>`

    - #### setInvocable

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

      Description copied from interface: `PropertySet`
      Convenience method to set invocable.
      Specified by:
        `setInvocable` in interface `PropertySet<KP>`

    - #### lazy

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

      Description copied from interface: `PropertySet`
      Puts callable to the property set. Value from callable is retrieved when `get()` method for the given name is invoked.
      Specified by:
        `lazy` in interface `PropertySet<KP>`

    - #### invoke

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

      Description copied from interface: `PropertySet`
      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.
      Specified by:
        `invoke` in interface `PropertySet<KP>`

    - #### shadowInvoke

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

      Description copied from interface: `PropertySet`
      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.
      Specified by:
        `shadowInvoke` in interface `PropertySet<KP>`

    - #### shadowGet

          public Object shadowGet(KP key)

      Description copied from interface: `PropertySet`
      Retrieves shadow property without conversion.
      Specified by:
        `shadowGet` in interface `PropertySet<KP>`

    - #### shadowGet

          public Object shadowGet(KP key,
                         Object defaultValue)

      Specified by:
        `shadowGet` in interface `PropertySet<KP>`
      Parameters:
        `key` - Property key.
        `defaultValue` - Default value.
      Returns:
        Property value or default value if property doesn't exist in the property set.

    - #### shadowGet

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

      Description copied from interface: `PropertySet`
      Retrieves property with conversion to target type.
      Specified by:
        `shadowGet` in interface `PropertySet<KP>`

    - #### shadowGet

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

      Specified by:
        `shadowGet` in interface `PropertySet<KP>`
      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

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

      Description copied from interface: `PropertySet`
      Retrieves shadow property without conversion.
      Specified by:
        `shadowGet` in interface `PropertySet<KP>`

    - #### shadowGet

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

      Specified by:
        `shadowGet` in interface `PropertySet<KP>`
      Parameters:
        `key` - Property key.
        `defaultValue` - Default value.
      Returns:
        Property value or default value if property doesn't exist in the property set.

    - #### shadowGet

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

      Description copied from interface: `PropertySet`
      Retrieves property with conversion to target type.
      Specified by:
        `shadowGet` in interface `PropertySet<KP>`

    - #### shadowGet

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

      Specified by:
        `shadowGet` in interface `PropertySet<KP>`
      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.

    - #### createVersion

          public PropertySet<KP> createVersion()

      Description copied from interface: `Versionable`
      Creates object version.
      Specified by:
        `createVersion` in interface `Versionable<PropertySet<KP>>`
      Returns: