public class

PropertyDefinitionManager

extends Object
implements IPropertyDefinitionManager
java.lang.Object
   ↳ com.pnfsoftware.jeb.core.properties.impl.PropertyDefinitionManager

Class Overview

A simple property definitions manager (PDM). Properties can be organized in regions and sub-regions.

Summary

[Expand]
Inherited Constants
From interface com.pnfsoftware.jeb.core.properties.IPropertyDefinitionManager
Public Constructors
PropertyDefinitionManager(String region, IPropertyDefinitionManager parent, String description, int flags)
Create a new PDM.
PropertyDefinitionManager(String region, IPropertyDefinitionManager parent)
PropertyDefinitionManager(String region)
Create a new PDM.
PropertyDefinitionManager()
Create a new PDM.
Public Methods
IPropertyDefinition addDefinition(String name, IPropertyType type, String description)
Add a property definition.
IPropertyDefinition addDefinition(String name, IPropertyType type, String description, int flags)
Add a property definition.
IPropertyDefinitionGroup addGroup(String name)
Create a group.
IPropertyDefinition addInternalDefinition(String name, IPropertyType type)
Add an internal property definition.
void attachToParent(IPropertyDefinitionManager parentManager)
Attach this PDM a parent PDM.
IPropertyDefinitionManager getChild(String name)
Get a child PDM by region name.
Collection<IPropertyDefinitionManager> getChildren()
Get the children of this PDM.
IPropertyDefinition getDefinition(String name)
Retrieve a property definition.
Collection<IPropertyDefinition> getDefinitions()
Get the list of definitions within this PDM.
String getDescription()
int getFlags()
IPropertyDefinitionGroup getGroup(String name)
Retrieve an existing group.
Collection<IPropertyDefinitionGroup> getGroups()
Retrieve all groups in this PDM.
String getNamespace()
Fully qualified namespace of this PDM, eg ".com.pnfsoftware.foo"
IPropertyDefinitionManager getParent()
Get the parent of this PDM.
String getRegion()
Region name (lower case), never null.
boolean hasChildren()
boolean hasDefinitions()
boolean isRoot()
Determine if this PDM is a root manager.
boolean registerChild(IPropertyDefinitionManager child)
Register a PDM as a child region.
void removeDefinition(String name)
Remove a property.
boolean removeGroup(String name)
Remove a group.
String toString()
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.pnfsoftware.jeb.core.properties.IPropertyDefinitionManager

Public Constructors

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 name
parent optional parent PDM, used to form a tree of properties, such as .region0.region1.PropertyXyz

public PropertyDefinitionManager (String region, IPropertyDefinitionManager parent)

public PropertyDefinitionManager (String region)

Create a new PDM. Same as PropertyDefinitionManager(region, null)

Parameters
region set to null to create a root PDM, else must be a valid region name

public PropertyDefinitionManager ()

Create a new PDM. Same as PropertyDefinitionManager(null, null)

Public Methods

public 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

public IPropertyDefinition addDefinition (String name, IPropertyType type, String description, int flags)

Add a property definition.

public IPropertyDefinitionGroup addGroup (String name)

Create a group.

public 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

public void attachToParent (IPropertyDefinitionManager parentManager)

Attach this PDM a parent PDM. The region name within the parent's children namespace must be available.

Parameters
parentManager a parent PDM

public IPropertyDefinitionManager getChild (String name)

Get a child PDM by region name.

Parameters
name the region name
Returns
  • the child, null if does not exist

public Collection<IPropertyDefinitionManager> getChildren ()

Get the children of this PDM.

Returns
  • a list of children, potentially empty (never null)

public 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

public 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

public String getDescription ()

public int getFlags ()

public IPropertyDefinitionGroup getGroup (String name)

Retrieve an existing group.

Parameters
name a non-empty name

public 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.

public String getNamespace ()

Fully qualified namespace of this PDM, eg ".com.pnfsoftware.foo"

Returns
  • the FQNS

public IPropertyDefinitionManager getParent ()

Get the parent of this PDM.

Returns
  • the parent, null if this PDM is a root

public String getRegion ()

Region name (lower case), never null. A root region is the empty-string.

Returns
  • the region name

public boolean hasChildren ()

public boolean hasDefinitions ()

public boolean isRoot ()

Determine if this PDM is a root manager.

public 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

public void removeDefinition (String name)

Remove a property.

Parameters
name the property name

public 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

public String toString ()