public class PropertySetter extends PropertyResolver
PropertyResolver
that also can
change properties by paths based on a given Resolvable
. The setting
process resolves the given property path up to the next to last path part.
When the result of this is a Changeable
or a Collection of
Changeables, the objects are modified by setting the property given by the
last part of the property path.Resolvable
representing a user. The call to
setProperty(String, Object)
with ("organisation.employees.email",
"a.b@foo.com") would first resolve "organisation.employees" to a
Collection
of Changeable
s representing all employees of the
user's organisation and would then change the email addresses by calling
Changeable.setProperty(String, Object)
with ("email", "a.b@foo.com")
for each.PropertyResolver.PropertyPathEntry
m_startObject
Constructor and Description |
---|
PropertySetter(Resolvable baseObject)
Create a propertySetter that resolves and sets properties based on the given Resolvable.
|
Modifier and Type | Method and Description |
---|---|
void |
addToProperty(String path,
Object value)
Add the given property to the properties resolved by the given path.
|
void |
addToProperty(String path,
Object value,
boolean allowDuplicates)
Add the given property to the properties resolved by the given path.
|
void |
performAssignment(Expression expression)
Perform the given assignment expression
|
protected void |
remove(Collection toModify,
Object toRemove)
Remove the given object from the given collection.
|
protected void |
removeAll(Collection toModify,
Collection toRemove)
Remove all objects in the collection from the given collection.
|
void |
removeFromProperty(String path,
Object value)
Remove the given value from the properties resolved by the given path.
|
void |
setProperty(String path,
Object value)
Set the property (properties) given by the path to the given value
|
canResolve, get, getProperty, resolve, resolve, resolve, resolve, resolvePath, resolvePath, resolvePath
public PropertySetter(Resolvable baseObject)
baseObject
- base objectpublic void setProperty(String path, Object value) throws UnknownPropertyException, InsufficientPrivilegesException
path
- path to a property/properties of an object/objectsvalue
- new value to setUnknownPropertyException
InsufficientPrivilegesException
public void addToProperty(String path, Object value) throws UnknownPropertyException, InsufficientPrivilegesException
path
- property pathvalue
- value to addUnknownPropertyException
InsufficientPrivilegesException
public void addToProperty(String path, Object value, boolean allowDuplicates) throws UnknownPropertyException, InsufficientPrivilegesException
path
- property pathvalue
- value to addallowDuplicates
- true when duplicates are allowed, false if notUnknownPropertyException
InsufficientPrivilegesException
public void removeFromProperty(String path, Object value) throws UnknownPropertyException, InsufficientPrivilegesException
path
- path of the propertyvalue
- value to removeUnknownPropertyException
InsufficientPrivilegesException
public void performAssignment(Expression expression) throws ExpressionParserException
expression
- assignment expressionExpressionParserException
protected void remove(Collection toModify, Object toRemove)
toModify
- collection to modifytoRemove
- object to removeprotected void removeAll(Collection toModify, Collection toRemove)
toModify
- collection to modifytoRemove
- collection of objects to removeCopyright © 2016 Gentics Software GmbH. All Rights Reserved.