Interface IPropertyDefinitionManager

All Known Implementing Classes:
PropertyDefinitionManager

public interface IPropertyDefinitionManager
API for a property definition manager (PDM). PDMs can be chained to form a hierarchy of properties. Each PDM defines a region. PDM regions are standard lower case identifiers. Properties are camel case identifiers. Naming convention should be enforced, not optional. Member methods should throw a RuntimeException on failure.

PDM support the definition of boolean, integer, and string properties.

  • Field Details

    • pdmGroupDefault

      static final String pdmGroupDefault
      The default (anonymous) group name: an empty string.
      See Also:
    • FLAG_ALLOW_LOOK_UP

      static final int FLAG_ALLOW_LOOK_UP
      See Also:
    • FLAG_MAY_ALPHASORT_CHILDREN

      static final int FLAG_MAY_ALPHASORT_CHILDREN
      If this flag is set, it indicates to clients that children PDM are in no particular order and may be sorted.
      See Also:
    • FLAG_SHOULD_NOT_ALPHASORT_CHILDREN

      static final int FLAG_SHOULD_NOT_ALPHASORT_CHILDREN
      If this flag is set, it indicates to clients that children PDM are in a specific order and should be sorted.
      See Also:
  • Method Details

    • getNamespace

      String getNamespace()
      Fully qualified namespace of this PDM, eg ".com.pnfsoftware.foo"
      Returns:
      the FQNS
    • getRegion

      String getRegion()
      Region name (lower case), never null. A root region is the empty-string.
      Returns:
      the region name
    • isRoot

      boolean isRoot()
      Determine if this PDM is a root manager.
      Returns:
    • getFlags

      int getFlags()
      Returns:
    • getDescription

      String getDescription()
      Returns:
    • attachToParent

      void attachToParent(IPropertyDefinitionManager parent)
      Attach this PDM a parent PDM. The region name within the parent's children namespace must be available.
      Parameters:
      parent - a parent PDM
    • registerChild

      boolean registerChild(IPropertyDefinitionManager child)
      Register a PDM as a child region. To be used in conjunction with attachToParent.
      Parameters:
      child - the child PDM
      Returns:
      success indicator
    • getParent

      Get the parent of this PDM.
      Returns:
      the parent, null if this PDM is a root
    • hasChildren

      boolean hasChildren()
      Returns:
    • getChildren

      Get the children of this PDM.
      Returns:
      a list of children, potentially empty (never null)
    • getChild

      Get a child PDM by region name.
      Parameters:
      name - the region name
      Returns:
      the child, null if does not exist
    • getDefinitions

      Collection<IPropertyDefinition> getDefinitions()
      Get the list of definitions within this PDM. Hierarchies are not navigated, only the current level properties are returned.
      Returns:
      never null
    • hasDefinitions

      boolean hasDefinitions()
      Returns:
    • getDefinition

      IPropertyDefinition getDefinition(String name)
      Retrieve a property definition.
      Parameters:
      name - the simple (local) property name (of a property managed by this manager)
      Returns:
      the definition of null
    • addDefinition

      IPropertyDefinition addDefinition(String name, IPropertyType type, String description)
      Add a property definition.
      Parameters:
      name - the property name
      type - the property type
      description - an optional description string
      Returns:
      the newly created property definition
    • addDefinition

      IPropertyDefinition addDefinition(String name, IPropertyType type, String description, int flags)
      Add a property definition.
      Parameters:
      name -
      type -
      description -
      flags -
      Returns:
    • addInternalDefinition

      IPropertyDefinition addInternalDefinition(String name, IPropertyType type)
      Add an internal property definition.
      Parameters:
      name - the property name
      type - the property type
      Returns:
      the newly created property definition
    • addInternalDefinition

      IPropertyDefinition addInternalDefinition(String name, IPropertyType type, String description)
      Add an internal property definition.
      Parameters:
      name - the property name
      type - the property type
      description - optional description
      Returns:
      the newly created property definition
    • removeDefinition

      void removeDefinition(String name)
      Remove a property.
      Parameters:
      name - the property name
    • addGroup

      Create a group.
      Parameters:
      name -
      Returns:
    • getGroup

      Retrieve an existing group.
      Parameters:
      name - a non-empty name
      Returns:
    • getGroups

      Retrieve all groups in this PDM. Note that the default group (whose name is empty) always exists and is returned as first element of the collection.
      Returns:
    • removeGroup

      boolean removeGroup(String name)
      Remove a group. When a group is removed, all its property definitions are added to the default group.
      Parameters:
      name - non-empty group name (the default group cannot be removed)
      Returns:
      success indicator