|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.commsen.apropos.core.PropertyPackage
public class PropertyPackage
This class represents a package of properties. In APropOS a package is simply a container of
Property objects. A package has name and may also have description, parent and child
packages.
| Constructor Summary | |
|---|---|
PropertyPackage(java.lang.String name)
Constructs new package |
|
PropertyPackage(java.lang.String name,
PropertyPackage parent)
Constructs new package |
|
PropertyPackage(java.lang.String name,
java.lang.String description)
Constructs new first level package (without parent) |
|
PropertyPackage(java.lang.String name,
java.lang.String description,
PropertyPackage parent)
Constructs new package |
|
| Method Summary | |
|---|---|
Property |
addProperty(Property property)
Adds new property to this package. |
java.util.Properties |
asProperties()
Converts this package to Properties object. |
java.lang.Object |
clone()
|
boolean |
containsChild(PropertyPackage propertyPackage)
Checks if propertyPackage is a child package of this package. |
java.util.Map<java.lang.String,Property> |
getAllProperties()
Returns a map of all properties from this package and all parent packages. |
java.util.List<PropertyPackage> |
getChildren()
|
java.lang.String |
getDescription()
|
java.lang.String |
getName()
|
java.util.Map<java.lang.String,Property> |
getOverwritenProperties()
Returns a map of all properties in this package which overwrite same properties from parent packages. |
PropertyPackage |
getParent()
|
java.util.Map<java.lang.String,Property> |
getProperties()
|
void |
importProperties(java.util.Properties externalProperties,
boolean overwrite)
Reads external Properties and adds them all to this package. |
Property |
removeProperty(Property property)
Removes property from this package |
Property |
removeProperty(java.lang.String propertyName)
Removes property called propertyName from this package |
void |
setDescription(java.lang.String description)
|
void |
setParent(PropertyPackage parent)
|
Property |
updateProperty(Property property)
Updates a property in this package. |
Property |
updateProperty(java.lang.String oldName,
Property property)
Updates a property called oldName in this package with values from
property. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PropertyPackage(java.lang.String name,
java.lang.String description,
PropertyPackage parent)
name - the name, this is required fielddescription - the descriptionparent - the parent package, if not provided it will become first level package
java.lang.IllegalArgumentException - if name is null or blank
public PropertyPackage(java.lang.String name,
java.lang.String description)
name - the name, this is required fielddescription - the description
public PropertyPackage(java.lang.String name,
PropertyPackage parent)
name - the name, this is required fieldparent - the parent package, if not provided it will become first level packagepublic PropertyPackage(java.lang.String name)
name - the name, this is required field| Method Detail |
|---|
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedException
public Property addProperty(Property property)
throws PropertiesException
property - the Property to be added. This is a required parameter
PropertiesException - if property with such name already exists
java.lang.IllegalArgumentException - if property is null
public Property updateProperty(Property property)
throws PropertiesException
property - the Property to be updated. This is a required parameter
PropertiesException - if no such property exists
java.lang.IllegalArgumentException - if property is null
public Property updateProperty(java.lang.String oldName,
Property property)
throws PropertiesException
oldName in this package with values from
property. If oldName is null this method behaves exactly like
updateProperty(Property)
oldName - the name of the property to be updatedproperty - the property to get values from
PropertiesException - if no such property exists
java.lang.IllegalArgumentException - if property is nullpublic Property removeProperty(Property property)
property - the property to be removed
public Property removeProperty(java.lang.String propertyName)
propertyName from this package
propertyName - the name of the property to be removed
public void importProperties(java.util.Properties externalProperties,
boolean overwrite)
Properties and adds them all to this package.
externalProperties - the external properties to be addedoverwrite - boolean flag indicating whether to overwrite existing properties
java.lang.IllegalArgumentException - if externalProperties is nullpublic java.util.Properties asProperties()
Properties object. The result object contains all properties
from all parents as returned by getAllProperties().
Properties objectpublic java.util.Map<java.lang.String,Property> getOverwritenProperties()
public java.util.Map<java.lang.String,Property> getAllProperties()
public boolean containsChild(PropertyPackage propertyPackage)
propertyPackage is a child package of this package.
propertyPackage - 0 the package to be checked
true if propertyPackage is a child package of this
package, false otherwise.public java.util.Map<java.lang.String,Property> getProperties()
public PropertyPackage getParent()
public void setParent(PropertyPackage parent)
throws PropertiesException
parent - the parent to set
PropertiesExceptionpublic java.lang.String getDescription()
public void setDescription(java.lang.String description)
description - the description to setpublic java.lang.String getName()
public java.util.List<PropertyPackage> getChildren()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||