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 property namespaces. Each PDM defines a region, and properties are registered within those regions.

  • 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
      Allow hierarchical property lookups to search parent namespaces when a local value is absent.
      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:
      true if this manager has no parent region
    • getFlags

      int getFlags()
      Get the PDM flags.
      Returns:
      a combination of FLAG_* constants
    • getDescription

      String getDescription()
      Get a human-readable description of this namespace.
      Returns:
      the description, or null
    • 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()
      Determine whether this PDM has child regions.
      Returns:
      true if child regions are registered
    • 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()
      Determine whether this PDM defines local properties.
      Returns:
      true if local property definitions exist
    • 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 - the property name
      type - the property type
      description - an optional description string
      flags - property flags, using IPropertyDefinition.FLAG_INTERNAL and related constants
      Returns:
      the newly created property definition
    • 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 - non-empty group name
      Returns:
      the newly created group
    • getGroup

      Retrieve an existing group.
      Parameters:
      name - a non-empty name
      Returns:
      the matching group, or null if none exists
    • 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:
      the groups of this manager
    • 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