public class PropertyManager extends java.lang.Object implements IPropertyManager
Modifier and Type | Field and Description |
---|---|
private static IPropertyManager |
instance |
private IStorageUtilityIndexed<? extends Externalizable> |
properties
The persistent storage utility
|
private java.util.List<IPropertyRules> |
rulesList
The list of rules
|
static java.lang.String |
STORAGE_KEY
The name for the Persistent storage utility name
|
Constructor and Description |
---|
PropertyManager()
Constructor for this PropertyManager
|
Modifier and Type | Method and Description |
---|---|
static IPropertyManager |
_() |
void |
addRules(IPropertyRules rules)
Adds a set of rules to be used by this PropertyManager.
|
boolean |
checkPropertyAllowed(java.lang.String propertyName)
Checks that a property is permitted to exist by any of the existing rules sets
|
boolean |
checkValueAllowed(java.lang.String propertyName,
java.lang.String propertyValue)
Checks that a property is allowed to store a certain value.
|
java.util.List<java.lang.String> |
getProperty(java.lang.String propertyName)
Retrieves the property specified, as long as it exists in one of the current rulesets
|
java.util.List<IPropertyRules> |
getRules()
Retrieves the set of rules being used by this property manager if any exist.
|
java.lang.String |
getSingularProperty(java.lang.String propertyName)
Retrieves the singular property specified, as long as it exists in one of the current rulesets
|
java.util.List<java.lang.String> |
getValue(java.lang.String name) |
static void |
initDefaultPropertyManager() |
private boolean |
listEquals(java.util.List<java.lang.String> v1,
java.util.List<java.lang.String> v2) |
private void |
notifyChanges(java.lang.String property)
Identifies the property rules set that the property belongs to, and notifies
it about the property change.
|
void |
setProperty(java.lang.String propertyName,
java.util.List<java.lang.String> propertyValue)
Sets the given property to the given vector value, if both are allowed by any existing ruleset
|
void |
setProperty(java.lang.String propertyName,
java.lang.String propertyValue)
Sets the given property to the given string value, if both are allowed by any existing ruleset
|
static void |
setPropertyManager(IPropertyManager pm) |
void |
setRules(IPropertyRules rules)
Sets the rules that should be used by this PropertyManager, removing any other
existing rules sets.
|
void |
writeValue(java.lang.String propertyName,
java.util.List<java.lang.String> value) |
private static IPropertyManager instance
public static final java.lang.String STORAGE_KEY
private java.util.List<IPropertyRules> rulesList
private IStorageUtilityIndexed<? extends Externalizable> properties
public static void setPropertyManager(IPropertyManager pm)
public static void initDefaultPropertyManager()
public static IPropertyManager _()
public java.lang.String getSingularProperty(java.lang.String propertyName)
getSingularProperty
in interface IPropertyManager
propertyName
- the name of the property being retrievedpublic java.util.List<java.lang.String> getProperty(java.lang.String propertyName)
getProperty
in interface IPropertyManager
propertyName
- the name of the property being retrievedpublic void setProperty(java.lang.String propertyName, java.lang.String propertyValue)
setProperty
in interface IPropertyManager
propertyName
- The property to be setpropertyValue
- The value that the property will be set topublic void setProperty(java.lang.String propertyName, java.util.List<java.lang.String> propertyValue)
setProperty
in interface IPropertyManager
propertyName
- The property to be setpropertyValue
- The value that the property will be set toprivate boolean listEquals(java.util.List<java.lang.String> v1, java.util.List<java.lang.String> v2)
public java.util.List<IPropertyRules> getRules()
getRules
in interface IPropertyManager
public void setRules(IPropertyRules rules)
rules
- The rules to be used.public void addRules(IPropertyRules rules)
addRules
in interface IPropertyManager
rules
- The set of rules to be added to the permitted listpublic boolean checkPropertyAllowed(java.lang.String propertyName)
propertyName
- The name of the property to be setpublic boolean checkValueAllowed(java.lang.String propertyName, java.lang.String propertyValue)
propertyName
- The name of the property to be setpropertyValue
- The value to be stored in the given propertyprivate void notifyChanges(java.lang.String property)
property
- The property that has been changedpublic java.util.List<java.lang.String> getValue(java.lang.String name)
public void writeValue(java.lang.String propertyName, java.util.List<java.lang.String> value)