Class PropertyDefinitionManager
java.lang.Object
com.pnfsoftware.jeb.core.properties.impl.PropertyDefinitionManager
- All Implemented Interfaces:
IPropertyDefinitionManager
Standard implementation of a property definitions manager (PDM). Properties can be organized in
regions and sub-regions.
-
Field Summary
Fields inherited from interface com.pnfsoftware.jeb.core.properties.IPropertyDefinitionManager
FLAG_ALLOW_LOOK_UP, FLAG_MAY_ALPHASORT_CHILDREN, FLAG_SHOULD_NOT_ALPHASORT_CHILDREN, pdmGroupDefault
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a new PDM.PropertyDefinitionManager
(String region) Create a new PDM.PropertyDefinitionManager
(String region, IPropertyDefinitionManager parent) PropertyDefinitionManager
(String region, IPropertyDefinitionManager parent, String description, int flags) Create a new PDM. -
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
attachToParent
(IPropertyDefinitionManager parentManager) 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.toString()
-
Constructor Details
-
PropertyDefinitionManager
public PropertyDefinitionManager(String region, IPropertyDefinitionManager parent, String description, int flags) Create a new PDM.- Parameters:
region
- set to null to create a root PDM, else must be a valid region name. A valid region name is a valid Java identifier nameparent
- optional parent PDM, used to form a tree of properties, such as.region0.region1.PropertyXyz
flags
-
-
PropertyDefinitionManager
-
PropertyDefinitionManager
Create a new PDM. Same asPropertyDefinitionManager(region, null)
- Parameters:
region
- set to null to create a root PDM, else must be a valid region name
-
PropertyDefinitionManager
public PropertyDefinitionManager()Create a new PDM. Same asPropertyDefinitionManager(null, null)
-
-
Method Details
-
attachToParent
Description copied from interface:IPropertyDefinitionManager
Attach this PDM a parent PDM. The region name within the parent's children namespace must be available.- Specified by:
attachToParent
in interfaceIPropertyDefinitionManager
- Parameters:
parentManager
- a parent PDM
-
registerChild
Description copied from interface:IPropertyDefinitionManager
Register a PDM as a child region. To be used in conjunction with attachToParent.- Specified by:
registerChild
in interfaceIPropertyDefinitionManager
- Parameters:
child
- the child PDM- Returns:
- success indicator
-
getRegion
Description copied from interface:IPropertyDefinitionManager
Region name (lower case), never null. A root region is the empty-string.- Specified by:
getRegion
in interfaceIPropertyDefinitionManager
- Returns:
- the region name
-
isRoot
public boolean isRoot()Description copied from interface:IPropertyDefinitionManager
Determine if this PDM is a root manager.- Specified by:
isRoot
in interfaceIPropertyDefinitionManager
- Returns:
-
getFlags
public int getFlags()- Specified by:
getFlags
in interfaceIPropertyDefinitionManager
- Returns:
-
getDescription
- Specified by:
getDescription
in interfaceIPropertyDefinitionManager
- Returns:
-
getParent
Description copied from interface:IPropertyDefinitionManager
Get the parent of this PDM.- Specified by:
getParent
in interfaceIPropertyDefinitionManager
- Returns:
- the parent, null if this PDM is a root
-
getNamespace
Description copied from interface:IPropertyDefinitionManager
Fully qualified namespace of this PDM, eg ".com.pnfsoftware.foo"- Specified by:
getNamespace
in interfaceIPropertyDefinitionManager
- Returns:
- the FQNS
-
hasChildren
public boolean hasChildren()- Specified by:
hasChildren
in interfaceIPropertyDefinitionManager
- Returns:
-
getChildren
Description copied from interface:IPropertyDefinitionManager
Get the children of this PDM.- Specified by:
getChildren
in interfaceIPropertyDefinitionManager
- Returns:
- a list of children, potentially empty (never null)
-
getChild
Description copied from interface:IPropertyDefinitionManager
Get a child PDM by region name.- Specified by:
getChild
in interfaceIPropertyDefinitionManager
- Parameters:
name
- the region name- Returns:
- the child, null if does not exist
-
hasDefinitions
public boolean hasDefinitions()- Specified by:
hasDefinitions
in interfaceIPropertyDefinitionManager
- Returns:
-
getDefinition
Description copied from interface:IPropertyDefinitionManager
Retrieve a property definition.- Specified by:
getDefinition
in interfaceIPropertyDefinitionManager
- Parameters:
name
- the simple (local) property name (of a property managed by this manager)- Returns:
- the definition of null
-
getDefinitions
Description copied from interface:IPropertyDefinitionManager
Get the list of definitions within this PDM. Hierarchies are not navigated, only the current level properties are returned.- Specified by:
getDefinitions
in interfaceIPropertyDefinitionManager
- Returns:
- never null
-
addDefinition
Description copied from interface:IPropertyDefinitionManager
Add a property definition.- Specified by:
addDefinition
in interfaceIPropertyDefinitionManager
- Parameters:
name
- the property nametype
- the property typedescription
- an optional description string- Returns:
- the newly created property definition
-
addDefinition
public IPropertyDefinition addDefinition(String name, IPropertyType type, String description, int flags) Description copied from interface:IPropertyDefinitionManager
Add a property definition.- Specified by:
addDefinition
in interfaceIPropertyDefinitionManager
- Returns:
-
addInternalDefinition
Description copied from interface:IPropertyDefinitionManager
Add an internal property definition.- Specified by:
addInternalDefinition
in interfaceIPropertyDefinitionManager
- Parameters:
name
- the property nametype
- the property type- Returns:
- the newly created property definition
-
addInternalDefinition
public IPropertyDefinition addInternalDefinition(String name, IPropertyType type, String description) Description copied from interface:IPropertyDefinitionManager
Add an internal property definition.- Specified by:
addInternalDefinition
in interfaceIPropertyDefinitionManager
- Parameters:
name
- the property nametype
- the property typedescription
- optional description- Returns:
- the newly created property definition
-
removeDefinition
Description copied from interface:IPropertyDefinitionManager
Remove a property.- Specified by:
removeDefinition
in interfaceIPropertyDefinitionManager
- Parameters:
name
- the property name
-
toString
-
addGroup
Description copied from interface:IPropertyDefinitionManager
Create a group.- Specified by:
addGroup
in interfaceIPropertyDefinitionManager
- Returns:
-
getGroups
Description copied from interface:IPropertyDefinitionManager
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.- Specified by:
getGroups
in interfaceIPropertyDefinitionManager
- Returns:
-
getGroup
Description copied from interface:IPropertyDefinitionManager
Retrieve an existing group.- Specified by:
getGroup
in interfaceIPropertyDefinitionManager
- Parameters:
name
- a non-empty name- Returns:
-
removeGroup
Description copied from interface:IPropertyDefinitionManager
Remove a group. When a group is removed, all its property definitions are added to the default group.- Specified by:
removeGroup
in interfaceIPropertyDefinitionManager
- Parameters:
name
- non-empty group name (the default group cannot be removed)- Returns:
- success indicator
-