net.infonode.properties.base
Class PropertyGroup

java.lang.Object
  extended by net.infonode.properties.base.PropertyGroup
Direct Known Subclasses:
PropertyMapGroup

public class PropertyGroup
extends java.lang.Object

A group of properties. The group have a name and a description. It can also have a super group from which it inherit all it's properties. You can think of a property group as similar to a Java class, and properties similar to class fields.

Version:
$Revision: 1.6 $
Author:
$Author: jesper $

Field Summary
private  java.lang.String description
           
private  java.lang.String name
           
private  java.util.ArrayList properties
           
private  PropertyGroup superGroup
           
 
Constructor Summary
PropertyGroup(PropertyGroup superGroup, java.lang.String name, java.lang.String description)
          Creates a property group with a super group.
PropertyGroup(java.lang.String name, java.lang.String description)
          Creates a property group.
 
Method Summary
 void addProperty(Property property)
          Add a property to this group.
 java.lang.String getDescription()
          Returns the description for this group.
 java.lang.String getName()
          Returns the name of this group.
 Property[] getProperties()
          Returns an array with the properties in this group.
 Property getProperty(int index)
          Returns the property at the index, This does not include properties in super groups.
 Property getProperty(java.lang.String name)
          Returns the property with the given name.
 int getPropertyCount()
          Returns the number of properties in this group.
 PropertyGroup getSuperGroup()
          Returns the super group of this group.
 boolean hasProperty(Property property)
          Returns true if this group or one of it's super groups contains the property.
private  boolean isA(PropertyGroup group)
          Returns true if the group is this group or one of it's super groups.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

superGroup

private PropertyGroup superGroup

name

private java.lang.String name

description

private java.lang.String description

properties

private java.util.ArrayList properties
Constructor Detail

PropertyGroup

public PropertyGroup(java.lang.String name,
                     java.lang.String description)
Creates a property group.

Parameters:
name - the name of the group
description - the group description

PropertyGroup

public PropertyGroup(PropertyGroup superGroup,
                     java.lang.String name,
                     java.lang.String description)
Creates a property group with a super group. All properties in the super group will be inherited to this group.

Parameters:
superGroup - the super group of this group
name - the name of the group
description - the group description
Method Detail

getSuperGroup

public PropertyGroup getSuperGroup()
Returns the super group of this group.

Returns:
the super group of this group, null if it has no super group

getDescription

public java.lang.String getDescription()
Returns the description for this group.

Returns:
the description for this group

getName

public java.lang.String getName()
Returns the name of this group.

Returns:
the name of this group

addProperty

public void addProperty(Property property)
Add a property to this group.

Parameters:
property - the property to add

getPropertyCount

public int getPropertyCount()
Returns the number of properties in this group. This does not include properties in super groups.

Returns:
the number of properties in this group

hasProperty

public boolean hasProperty(Property property)
Returns true if this group or one of it's super groups contains the property.

Parameters:
property - the property
Returns:
true if this group or one of it's super groups contains the property

getProperty

public Property getProperty(int index)
Returns the property at the index, This does not include properties in super groups.

Parameters:
index - the property index
Returns:
the property at the index

getProperties

public Property[] getProperties()
Returns an array with the properties in this group. This does not include properties in super groups.

Returns:
an array with the properties in this group

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getProperty

public Property getProperty(java.lang.String name)
Returns the property with the given name. This includes properties in super groups.

Parameters:
name - the property name
Returns:
the property with the given name, null if no property was found

isA

private boolean isA(PropertyGroup group)
Returns true if the group is this group or one of it's super groups.

Parameters:
group - the group
Returns:
true if the group is this group or one of it's super groups