KP - Key pathKE - Key path elementpublic abstract class AbstractPropertySet<KP,KE> extends Object implements PropertySet<KP>, ReadWriteLock
| Modifier and Type | Field and Description |
|---|---|
protected Context |
context |
protected Converter |
converter |
protected ExecutorService |
executorService |
protected PropertySet<KP>[] |
shadows |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractPropertySet(ExecutorService executorService,
Converter converter,
Context context,
PropertySet<KP>... shadows) |
| Modifier and Type | Method and Description |
|---|---|
protected abstract KP |
buildPath(int startIdx,
Object... elements) |
protected abstract KP |
buildPath(KE prefix,
KP suffix) |
protected abstract KP |
buildPath(KP prefix,
Object... elements) |
protected KP |
buildPath(Object... elements) |
protected void |
cancel(KE[] path,
int idx) |
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
|
protected void |
cook(KE[] path,
int idx,
Callable<?> callable,
long delay,
TimeUnit timeUnit) |
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.
|
protected Object |
get(KE[] path,
int idx,
Object[] va) |
protected Object |
get(KE[] path,
int idx,
Object[] va,
long timeout,
TimeUnit unit) |
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) |
protected abstract Map<KE,PropertySet<KP>> |
getMounts() |
protected abstract Map<KE,AbstractPropertySet<KP,KE>> |
getSubSetStore() |
protected abstract Map<KE,Object> |
getValueStore() |
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.
|
protected void |
mount(KE[] path,
int idx,
PropertySet<KP> source) |
void |
mount(KP prefix,
PropertySet<KP> source)
Mounts source property set at specified prefix.
|
protected abstract AbstractPropertySet<KP,KE> |
newInstance(KE key)
Creates a property set which shares lock and chain with this one.
|
protected void |
remove(KE[] path,
int idx) |
void |
remove(KP key)
Removes property from the set.
|
protected void |
set(KE[] path,
int idx,
Object value) |
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.
|
protected PropertySet<KP> |
subset(KE[] prefix,
int idx,
boolean create) |
PropertySet<KP> |
subset(KP prefix) |
protected abstract KE[] |
tokenize(KP path) |
protected void |
unmount(KE[] path,
int idx) |
void |
unmount(KP prefix) |
protected abstract <T> T |
version(T source)
Versions object for forward-only change propagation purposes.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAdaptercreateVersionreadLock, writeLockprotected ExecutorService executorService
protected PropertySet<KP>[] shadows
protected AbstractPropertySet(ExecutorService executorService, Converter converter, Context context, PropertySet<KP>... shadows)
protected abstract Map<KE,Object> getValueStore()
protected abstract Map<KE,AbstractPropertySet<KP,KE>> getSubSetStore()
protected abstract AbstractPropertySet<KP,KE> newInstance(KE key)
protected abstract Map<KE,PropertySet<KP>> getMounts()
protected abstract <T> T version(T source)
T - source - public Set<KP> keySet()
keySet in interface PropertySet<KP>public PropertySet<KP> subset(KP prefix)
subset in interface PropertySet<KP>protected PropertySet<KP> subset(KE[] prefix, int idx, boolean create)
public void remove(KP key)
PropertySetremove in interface PropertySet<KP>public void clear()
PropertySetclear in interface PropertySet<KP>public void mount(KP prefix, PropertySet<KP> source)
PropertySetmount in interface PropertySet<KP>protected void mount(KE[] path, int idx, PropertySet<KP> source)
public void unmount(KP prefix)
unmount in interface PropertySet<KP>public void setAll(PropertySet<KP> source)
PropertySetsetAll in interface PropertySet<KP>public Object get(KP key)
PropertySetget in interface PropertySet<KP>public Object get(KP key, long timeout, TimeUnit unit)
PropertySetget in interface PropertySet<KP>public Object get(KP key, Object defaultValue)
get in interface PropertySet<KP>key - Property key.defaultValue - Default value.public Object get(KP key, Object defaultValue, long timeout, TimeUnit unit)
get in interface PropertySet<KP>key - Property key.defaultValue - Default value.public <T> T get(KP key, Class<T> type)
PropertySetget in interface PropertySet<KP>public <T> T get(KP key, Class<T> type, long timeout, TimeUnit unit)
PropertySetget in interface PropertySet<KP>public <T> T get(KP key, Class<T> type, T defaultValue)
get in interface PropertySet<KP>key - Property key.type - target type.defaultValue - Default value.public <T> T get(KP key, Class<T> type, T defaultValue, long timeout, TimeUnit unit)
get in interface PropertySet<KP>key - Property key.type - target type.defaultValue - Default value.public void set(KP key, Object value)
PropertySetset in interface PropertySet<KP>public void setInvocable(KP key, Invocable<PropertySet<KP>,?,KP,?> invocable)
PropertySetsetInvocable in interface PropertySet<KP>public void cook(KP key, Callable<?> callable)
PropertySetcook in interface PropertySet<KP>public void cook(KP key, Callable<?> callable, long delay, TimeUnit timeUnit)
PropertySetcook in interface PropertySet<KP>public void cooking(KP key, Future<?> future)
PropertySetcooking in interface PropertySet<KP>future - Value being cooked.public void lazy(KP key, Callable<?> callable)
PropertySetget() method for the given name is invoked.lazy in interface PropertySet<KP>public void cancel(KP key)
PropertySetcancel in interface PropertySet<KP>public void cancelAll()
PropertySetcancelAll in interface PropertySet<KP>public Object invoke(KP key, Object... args)
PropertySetinvoke in interface PropertySet<KP>public Object shadowInvoke(KP key, Object... args)
PropertySetshadowInvoke in interface PropertySet<KP>public Object shadowGet(KP key)
PropertySetshadowGet in interface PropertySet<KP>public Object shadowGet(KP key, Object defaultValue)
shadowGet in interface PropertySet<KP>key - Property key.defaultValue - Default value.public <T> T shadowGet(KP key, Class<T> type)
PropertySetshadowGet in interface PropertySet<KP>public <T> T shadowGet(KP key, Class<T> type, T defaultValue)
shadowGet in interface PropertySet<KP>key - Property key.type - target type.defaultValue - Default value.public Object shadowGet(KP key, long timeout, TimeUnit unit)
PropertySetshadowGet in interface PropertySet<KP>public Object shadowGet(KP key, Object defaultValue, long timeout, TimeUnit unit)
shadowGet in interface PropertySet<KP>key - Property key.defaultValue - Default value.public <T> T shadowGet(KP key, Class<T> type, long timeout, TimeUnit unit)
PropertySetshadowGet in interface PropertySet<KP>public <T> T shadowGet(KP key, Class<T> type, T defaultValue, long timeout, TimeUnit unit)
shadowGet in interface PropertySet<KP>key - Property key.type - target type.defaultValue - Default value.