public interface

IPropertyDefinitionManager

com.pnfsoftware.jeb.core.properties.IPropertyDefinitionManager
Known Indirect Subclasses

Class Overview

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.

Summary

Constants
int FLAG_ALLOW_LOOK_UP
int FLAG_MAY_ALPHASORT_CHILDREN If this flag is set, it indicates to clients that children PDM are in no particular order and may be sorted.
int FLAG_SHOULD_NOT_ALPHASORT_CHILDREN If this flag is set, it indicates to clients that children PDM are in a specific order and should be sorted.
String pdmGroupDefault The default (anonymous) group name: an empty string.
Public Methods
abstract IPropertyDefinition addDefinition(String name, IPropertyType type, String description)
Add a property definition.
abstract IPropertyDefinition addDefinition(String name, IPropertyType type, String description, int flags)
Add a property definition.
abstract IPropertyDefinitionGroup addGroup(String name)
Create a group.
abstract IPropertyDefinition addInternalDefinition(String name, IPropertyType type)
Add an internal property definition.
abstract void attachToParent(IPropertyDefinitionManager parent)
Attach this PDM a parent PDM.
abstract IPropertyDefinitionManager getChild(String name)
Get a child PDM by region name.
abstract Collection<IPropertyDefinitionManager> getChildren()
Get the children of this PDM.
abstract IPropertyDefinition getDefinition(String name)
Retrieve a property definition.
abstract Collection<IPropertyDefinition> getDefinitions()
Get the list of definitions within this PDM.
abstract String getDescription()
abstract int getFlags()
abstract IPropertyDefinitionGroup getGroup(String name)
Retrieve an existing group.
abstract Collection<IPropertyDefinitionGroup> getGroups()
Retrieve all groups in this PDM.
abstract String getNamespace()
Fully qualified namespace of this PDM, eg ".com.pnfsoftware.foo"
abstract IPropertyDefinitionManager getParent()
Get the parent of this PDM.
abstract String getRegion()
Region name (lower case), never null.
abstract boolean hasChildren()
abstract boolean hasDefinitions()
abstract boolean isRoot()
Determine if this PDM is a root manager.
abstract boolean registerChild(IPropertyDefinitionManager child)
Register a PDM as a child region.
abstract void removeDefinition(String name)
Remove a property.
abstract boolean removeGroup(String name)
Remove a group.

Constants

public static final int FLAG_ALLOW_LOOK_UP

Constant Value: 1 (0x00000001)

public static final int FLAG_MAY_ALPHASORT_CHILDREN

If this flag is set, it indicates to clients that children PDM are in no particular order and may be sorted.

Constant Value: 16 (0x00000010)

public static final int FLAG_SHOULD_NOT_ALPHASORT_CHILDREN

If this flag is set, it indicates to clients that children PDM are in a specific order and should be sorted.

Constant Value: 32 (0x00000020)

public static final String pdmGroupDefault

The default (anonymous) group name: an empty string.

Constant Value: ""

Public Methods

public abstract 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 abstract IPropertyDefinition addDefinition (String name, IPropertyType type, String description, int flags)

Add a property definition.

public abstract IPropertyDefinitionGroup addGroup (String name)

Create a group.

public abstract 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 abstract void attachToParent (IPropertyDefinitionManager parent)

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

Parameters
parent a parent PDM

public abstract 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 abstract Collection<IPropertyDefinitionManager> getChildren ()

Get the children of this PDM.

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

public abstract 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 abstract 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 abstract String getDescription ()

public abstract int getFlags ()

public abstract IPropertyDefinitionGroup getGroup (String name)

Retrieve an existing group.

Parameters
name a non-empty name

public abstract 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 abstract String getNamespace ()

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

Returns
  • the FQNS

public abstract IPropertyDefinitionManager getParent ()

Get the parent of this PDM.

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

public abstract String getRegion ()

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

Returns
  • the region name

public abstract boolean hasChildren ()

public abstract boolean hasDefinitions ()

public abstract boolean isRoot ()

Determine if this PDM is a root manager.

public abstract 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 abstract void removeDefinition (String name)

Remove a property.

Parameters
name the property name

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