Class PropertyDefinitionManager
java.lang.Object
com.pnfsoftware.jeb.core.properties.impl.PropertyDefinitionManager
- All Implemented Interfaces:
IPropertyDefinitionManager
Standard implementation of
IPropertyDefinitionManager.
Properties can be organized in regions, sub-regions, and display groups.
-
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) Create a new PDM with default flags and no description.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.Get a human-readable description of this namespace.intgetFlags()Get the PDM flags.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.booleanDetermine whether this PDM has child regions.booleanDetermine whether this PDM defines local properties.booleanisRoot()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.PropertyXyzdescription- optional namespace descriptionflags- manager flags
-
PropertyDefinitionManager
Create a new PDM with default flags and no description.- Parameters:
region- region name, ornullfor a root PDMparent- optional parent PDM
-
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:
trueif this manager has no parent region
-
getFlags
public int getFlags()Description copied from interface:IPropertyDefinitionManagerGet the PDM flags.- Specified by:
getFlagsin interfaceIPropertyDefinitionManager- Returns:
- a combination of
FLAG_*constants
-
getDescription
Description copied from interface:IPropertyDefinitionManagerGet a human-readable description of this namespace.- Specified by:
getDescriptionin interfaceIPropertyDefinitionManager- Returns:
- the description, or
null
-
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()Description copied from interface:IPropertyDefinitionManagerDetermine whether this PDM has child regions.- Specified by:
hasChildrenin interfaceIPropertyDefinitionManager- Returns:
trueif child regions are registered
-
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()Description copied from interface:IPropertyDefinitionManagerDetermine whether this PDM defines local properties.- Specified by:
hasDefinitionsin interfaceIPropertyDefinitionManager- Returns:
trueif local property definitions exist
-
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- Parameters:
name- the property nametype- the property typedescription- an optional description stringflags- property flags, usingIPropertyDefinition.FLAG_INTERNALand related constants- Returns:
- the newly created property definition
-
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- Parameters:
name- non-empty group name- Returns:
- the newly created group
-
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:
- the groups of this manager
-
getGroup
Description copied from interface:IPropertyDefinitionManagerRetrieve an existing group.- Specified by:
getGroupin interfaceIPropertyDefinitionManager- Parameters:
name- a non-empty name- Returns:
- the matching group, or
nullif none exists
-
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
-