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.voidattachToParent(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.intgetFlags()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.booleanbooleanbooleanisRoot()Determine if this PDM is a root manager.booleanRegister a PDM as a child region.voidremoveDefinition(String name) Remove a property.booleanremoveGroup(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.PropertyXyzflags-
-
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:IPropertyDefinitionManagerAttach this PDM a parent PDM. The region name within the parent's children namespace must be available.- Specified by:
attachToParentin interfaceIPropertyDefinitionManager- Parameters:
parentManager- a parent PDM
-
registerChild
Description copied from interface:IPropertyDefinitionManagerRegister a PDM as a child region. To be used in conjunction with attachToParent.- Specified by:
registerChildin interfaceIPropertyDefinitionManager- Parameters:
child- the child PDM- Returns:
- success indicator
-
getRegion
Description copied from interface:IPropertyDefinitionManagerRegion name (lower case), never null. A root region is the empty-string.- Specified by:
getRegionin interfaceIPropertyDefinitionManager- Returns:
- the region name
-
isRoot
public boolean isRoot()Description copied from interface:IPropertyDefinitionManagerDetermine if this PDM is a root manager.- Specified by:
isRootin interfaceIPropertyDefinitionManager- Returns:
-
getFlags
public int getFlags()- Specified by:
getFlagsin interfaceIPropertyDefinitionManager- Returns:
-
getDescription
- Specified by:
getDescriptionin interfaceIPropertyDefinitionManager- Returns:
-
getParent
Description copied from interface:IPropertyDefinitionManagerGet the parent of this PDM.- Specified by:
getParentin interfaceIPropertyDefinitionManager- Returns:
- the parent, null if this PDM is a root
-
getNamespace
Description copied from interface:IPropertyDefinitionManagerFully qualified namespace of this PDM, eg ".com.pnfsoftware.foo"- Specified by:
getNamespacein interfaceIPropertyDefinitionManager- Returns:
- the FQNS
-
hasChildren
public boolean hasChildren()- Specified by:
hasChildrenin interfaceIPropertyDefinitionManager- Returns:
-
getChildren
Description copied from interface:IPropertyDefinitionManagerGet the children of this PDM.- Specified by:
getChildrenin interfaceIPropertyDefinitionManager- Returns:
- a list of children, potentially empty (never null)
-
getChild
Description copied from interface:IPropertyDefinitionManagerGet a child PDM by region name.- Specified by:
getChildin interfaceIPropertyDefinitionManager- Parameters:
name- the region name- Returns:
- the child, null if does not exist
-
hasDefinitions
public boolean hasDefinitions()- Specified by:
hasDefinitionsin interfaceIPropertyDefinitionManager- Returns:
-
getDefinition
Description copied from interface:IPropertyDefinitionManagerRetrieve a property definition.- Specified by:
getDefinitionin 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:IPropertyDefinitionManagerGet the list of definitions within this PDM. Hierarchies are not navigated, only the current level properties are returned.- Specified by:
getDefinitionsin interfaceIPropertyDefinitionManager- Returns:
- never null
-
addDefinition
Description copied from interface:IPropertyDefinitionManagerAdd a property definition.- Specified by:
addDefinitionin 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:IPropertyDefinitionManagerAdd a property definition.- Specified by:
addDefinitionin interfaceIPropertyDefinitionManager- Returns:
-
addInternalDefinition
Description copied from interface:IPropertyDefinitionManagerAdd an internal property definition.- Specified by:
addInternalDefinitionin 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:IPropertyDefinitionManagerAdd an internal property definition.- Specified by:
addInternalDefinitionin interfaceIPropertyDefinitionManager- Parameters:
name- the property nametype- the property typedescription- optional description- Returns:
- the newly created property definition
-
removeDefinition
Description copied from interface:IPropertyDefinitionManagerRemove a property.- Specified by:
removeDefinitionin interfaceIPropertyDefinitionManager- Parameters:
name- the property name
-
toString
-
addGroup
Description copied from interface:IPropertyDefinitionManagerCreate a group.- Specified by:
addGroupin interfaceIPropertyDefinitionManager- Returns:
-
getGroups
Description copied from interface:IPropertyDefinitionManagerRetrieve 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:
getGroupsin interfaceIPropertyDefinitionManager- Returns:
-
getGroup
Description copied from interface:IPropertyDefinitionManagerRetrieve an existing group.- Specified by:
getGroupin interfaceIPropertyDefinitionManager- Parameters:
name- a non-empty name- Returns:
-
removeGroup
Description copied from interface:IPropertyDefinitionManagerRemove a group. When a group is removed, all its property definitions are added to the default group.- Specified by:
removeGroupin interfaceIPropertyDefinitionManager- Parameters:
name- non-empty group name (the default group cannot be removed)- Returns:
- success indicator
-