public class PropertyBlockImpl extends Object implements IPropertyBlock
IPropertyBlock.IMapBuilder<K,V>| Modifier and Type | Field and Description |
|---|---|
static Set<String> |
EMPTY_KEYSET |
static List<IPropertyBlockModifyListener> |
EMPTY_MODIFY_LISTENER |
static Map<String,Object> |
EMPTY_PROPERTIES |
| Modifier | Constructor and Description |
|---|---|
protected |
PropertyBlockImpl(MessageDispatcherImpl dispatcher) |
| Modifier and Type | Method and Description |
|---|---|
void |
addModifyListener(IPropertyBlockModifyListener listener) |
Map<String,Object> |
clear()
remove all property entries
|
Supplier<List<PropertyBlockModifyItem>> |
computeProcedure(IPropertyBlockAtomicProcedure operationHandler)
Enables complex editing in locked mode with
IPropertyBlockAtomicProcedure. |
boolean |
containsKey(Object key)
returns true if this propertyblock contains entry with
key ( key==null ? k==null : key.equals(k)). |
void |
dispose() |
Map<String,IMatchable> |
getMatchables() |
Map<String,Object> |
getProperties()
returns an immutable deep copy of property-container as
Map |
Object |
getProperty(String key)
getter for registered property with associated
key |
<T> T |
getProperty(String key,
Class<T> resultClass)
typed getter for registered property with associated
key |
Set<String> |
getPropertyKeySet()
returns an immutable
Set of all registered property keys |
<T> T |
getPropertyOrDefault(String key,
Class<T> resultClass,
T defaultValue)
typed getter for registered property with associated
key |
String |
getPropertyOrDefaultAsString(String key,
String defaultValue)
String-typed getter for registered property with associated
key. |
boolean |
isEmpty()
Returns true if this propertyblock contains no entries
|
IPropertyLock |
lockProperty(String key)
locks a property to prevent writable access
|
void |
removeModifyListener(IPropertyBlockModifyListener listener) |
Object |
removeProperty(String key)
remove registered property with associated
key |
Object |
setProperty(String key,
Object value)
register a property
value with associated key |
Map<String,Object> |
setPropertyEntrySet(Set<Map.Entry<String,Object>> propertyEntrySet,
boolean ignoreIfEquals)
register a set of properties
|
protected void |
unlockAllProperties() |
protected boolean |
unlockProperty(PropertyLockImpl lock) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAdapter, getAdapter, getPropertyOrSupply, removeAdapter, setAdapterpublic static final List<IPropertyBlockModifyListener> EMPTY_MODIFY_LISTENER
protected PropertyBlockImpl(MessageDispatcherImpl dispatcher)
public Object setProperty(String key, Object value)
IPropertyBlockvalue with associated keysetProperty in interface IPropertyBlockkey - key with which the specified property is to be associatedvalue - property to be associated with the specified keykey, or nullpublic Map<String,Object> setPropertyEntrySet(Set<Map.Entry<String,Object>> propertyEntrySet, boolean ignoreIfEquals)
IPropertyBlocksetPropertyEntrySet in interface IPropertyBlockpropertyEntrySet - with new valuesignoreIfEquals - switch to skip updates, if old value equals new valuepublic Object getProperty(String key)
IPropertyBlockkeygetProperty in interface IPropertyBlockkey - the key whose associated property is to be returnedpublic Object removeProperty(String key)
IPropertyBlockkeyremoveProperty in interface IPropertyBlockkey - key the key whose associated property is to be removedpublic Set<String> getPropertyKeySet()
IPropertyBlockSet of all registered property keysgetPropertyKeySet in interface IPropertyBlockpublic Map<String,Object> getProperties()
IPropertyBlockMapgetProperties in interface IPropertyBlockMap with propertiespublic Map<String,IMatchable> getMatchables()
public Map<String,Object> clear()
IPropertyBlockclear in interface IPropertyBlockpublic void addModifyListener(IPropertyBlockModifyListener listener)
addModifyListener in interface IPropertyBlockpublic void removeModifyListener(IPropertyBlockModifyListener listener)
removeModifyListener in interface IPropertyBlockpublic void dispose()
dispose in interface IPropertyBlockpublic boolean isEmpty()
IPropertyBlockisEmpty in interface IPropertyBlockpublic boolean containsKey(Object key)
IPropertyBlockkey ( key==null ? k==null : key.equals(k)).containsKey in interface IPropertyBlockkey - key whose presence in this propertyblock is to be testedpublic <T> T getProperty(String key, Class<T> resultClass)
IPropertyBlockkeygetProperty in interface IPropertyBlockkey - the key whose associated property is to be returnedresultClass - the type of propertypublic <T> T getPropertyOrDefault(String key, Class<T> resultClass, T defaultValue)
IPropertyBlockkeygetPropertyOrDefault in interface IPropertyBlockkey - the key whose associated property is to be returnedresultClass - the type of propertydefaultValue - return value if property with specified key not exist or is nulldefaultValue if property does not existspublic String getPropertyOrDefaultAsString(String key, String defaultValue)
IPropertyBlockkey. For Non-string value Object.toString() is used as formatter.getPropertyOrDefaultAsString in interface IPropertyBlockkey - the key whose associated property is to be returneddefaultValue - return value if property with specified key not exist or is null/emptydefaultValue if property does not existspublic IPropertyLock lockProperty(String key)
IPropertyBlocklockProperty in interface IPropertyBlockkey - the key whose associated property is to be lockedIPropertyBlock or null, if property is already lockedprotected void unlockAllProperties()
protected boolean unlockProperty(PropertyLockImpl lock)
public Supplier<List<PropertyBlockModifyItem>> computeProcedure(IPropertyBlockAtomicProcedure operationHandler)
IPropertyBlockIPropertyBlockAtomicProcedure.computeProcedure in interface IPropertyBlockoperationHandler - handle to edit propertyCopyright © 2020. All rights reserved.