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 Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
If this flag is set, it indicates to clients that children PDM are in no particular order and may be sorted.static final int
If this flag is set, it indicates to clients that children PDM are in a specific order and should be sorted.static final String
The default (anonymous) group name: an empty string. -
Method Summary
Modifier and TypeMethodDescriptionaddDefinition
(String name, IPropertyType type, String description) Add a property definition.addDefinition
(String name, IPropertyType type, String description, int flags) Add a property definition.Create a group.addInternalDefinition
(String name, IPropertyType type) Add an internal property definition.addInternalDefinition
(String name, IPropertyType type, String description) Add an internal property definition.void
Attach this PDM a parent PDM.Get a child PDM by region name.Get the children of this PDM.getDefinition
(String name) Retrieve a property definition.Get the list of definitions within this PDM.int
getFlags()
Retrieve an existing group.Retrieve all groups in this PDM.Fully qualified namespace of this PDM, eg ".com.pnfsoftware.foo"Get the parent of this PDM.Region name (lower case), never null.boolean
boolean
boolean
isRoot()
Determine if this PDM is a root manager.boolean
Register a PDM as a child region.void
removeDefinition
(String name) Remove a property.boolean
removeGroup
(String name) Remove a group.
-
Field Details
-
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_CHILDRENIf 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_CHILDRENIf 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
Attach this PDM a parent PDM. The region name within the parent's children namespace must be available.- Parameters:
parent
- a parent PDM
-
registerChild
Register a PDM as a child region. To be used in conjunction with attachToParent.- Parameters:
child
- the child PDM- Returns:
- success indicator
-
getParent
IPropertyDefinitionManager getParent()Get the parent of this PDM.- Returns:
- the parent, null if this PDM is a root
-
hasChildren
boolean hasChildren()- Returns:
-
getChildren
Collection<IPropertyDefinitionManager> 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
Retrieve a property definition.- Parameters:
name
- the simple (local) property name (of a property managed by this manager)- Returns:
- the definition of null
-
addDefinition
Add a property definition.- Parameters:
name
- the property nametype
- the property typedescription
- an optional description string- Returns:
- the newly created property definition
-
addDefinition
Add a property definition.- Parameters:
name
-type
-description
-flags
-- Returns:
-
addInternalDefinition
Add an internal property definition.- Parameters:
name
- the property nametype
- the property type- Returns:
- the newly created property definition
-
addInternalDefinition
Add an internal property definition.- Parameters:
name
- the property nametype
- the property typedescription
- optional description- Returns:
- the newly created property definition
-
removeDefinition
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
Collection<IPropertyDefinitionGroup> 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
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
-