Class BeanUpdate
java.lang.Object
com.tccc.kos.commons.core.service.config.BeanUpdate
Data class that contains updates to apply to a bean with the specified handle path.
The replace
flag can be used to remove all previous configuration changes
made to the target bean before applying updates. If this contains no updates, this
effectively reverts the target bean back back to default values.
Any updates to apply to the target bean are specified in attribute / value pairs. The attribute is specified in dotted notation for config beans that are object graphs rather than simple beans.
Setting any particular attribute to a value of "^^"
will revert the attribute
back to the default value.
- Since:
- 1.0
- Version:
- 2022-08-30
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a default instance.BeanUpdate
(String path) Constructs a new update record for a bean with the specified handle. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Add an updated value to the update.getPath()
Return the path of the bean to apply the updates to.getScope()
Return the scope of the update.boolean
void
Set the path of the bean to apply the updates to.void
setReplace
(boolean replace) Set the replace flag.void
Set the scope for the update.void
toString()
-
Constructor Details
-
BeanUpdate
public BeanUpdate()Constructs a default instance. -
BeanUpdate
Constructs a new update record for a bean with the specified handle.- Parameters:
path
- handle path of the bean the updates are for
-
-
Method Details
-
getPath
Return the path of the bean to apply the updates to. This will never include the scope. -
setPath
Set the path of the bean to apply the updates to. If the path includes a scope prefix, the scope will be set automatically and the resulting path will be without the scope prefix. If there is no scope prefix, the scope will remain unmodified.- Parameters:
path
- handle path to the bean to update
-
getScope
Return the scope of the update. The update will only impact nodes that match the specified scope. Empty string is the global scope. -
setScope
Set the scope for the update. If not set, the default scope is empty string which is the global scope. This can be set by calling this setter, or by callingsetPath()
using a path with a scope prefix.- Parameters:
scope
- the scope of the path
-
setReplace
public void setReplace(boolean replace) Set the replace flag. If set to true, all existing overrides for the handle path will be removed and these updates will be applied. This effectively replaces all previous configuration settings with these settings.If set to false, these updates will be applied on top of any existing configuration settings.
-
add
Add an updated value to the update.- Parameters:
attr
- the attribute to updateval
- the new value
-
toString
-
isReplace
public boolean isReplace() -
getValues
-
setValues
-