Class BeanUpdate

java.lang.Object
com.tccc.kos.commons.core.service.config.BeanUpdate

public class BeanUpdate extends Object
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 Details

    • BeanUpdate

      public BeanUpdate()
      Constructs a default instance.
    • BeanUpdate

      public BeanUpdate(String path)
      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

      public String getPath()
      Return the path of the bean to apply the updates to. This will never include the scope.
    • setPath

      public void setPath(String path)
      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

      public String 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

      public void setScope(String scope)
      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 calling setPath() 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

      public void add(String attr, Object val)
      Add an updated value to the update.
      Parameters:
      attr - the attribute to update
      val - the new value
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isReplace

      public boolean isReplace()
    • getValues

      public Map<String,Object> getValues()
    • setValues

      public void setValues(Map<String,Object> values)