|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmro.util.properties.Properties
public class Properties
This class works a bit like java.util.Properties.
The main difference is that each value is stored as a
Property
-object,
which may have a description attached to it. The Property-objects
also may have PropertyValueDescription
:s. These store
a description of the meaning of a certain value of the Property.
Further the Property:s may be grouped together in
PropertyGroup
:s.
Each Properties is tied to a owner object. That object is remembered
with a UniqueIdentifier
. The Properties may also have several
related identifiers, also UniqueIdentifiers.
When using Properties as a instance field, let the class implement
the HasProperties-interface. Set the properties owner to the instance
using the setOwnerIdentifier(mro.util.UniqueIdentifier)
method.
A Properties-object is conveniently saved/loaded to/from a XML-file. Using the identifiers a datastructure of different objects may be rebuilt.
Property
,
PropertyValueDescription
,
PropertyGroup
,
UniqueIdentifier
Constructor Summary | |
---|---|
Properties(Properties ps)
Copy constructor. |
|
Properties(java.lang.String name)
A constructor. |
|
Properties(java.lang.String name,
UniqueIdentifier ownerIdentifier)
A constructor. |
Method Summary | |
---|---|
void |
addProperty(Property p)
Adds a Property (or a PropertyGroup ) to the Properties. |
void |
addRelatedIdentifier(UniqueIdentifier relatedIdentifier)
Add a UniqueIdentifier as a related identifier. |
java.lang.String |
getAppropriateValueDescription(java.lang.String name)
|
UniqueIdentifier |
getOwnerIdentifier()
Returns the owner identifier (a UniqueIdentifier ). |
java.lang.String |
getPropertiesName()
|
Property |
getProperty(java.lang.String name)
Returns a Property with the specified name. |
PropertyGroup |
getPropertyGroup(java.lang.String propertyGroupName)
Returns a PropertyGroup with the specified name. |
java.lang.Object |
getPropertyValue(java.lang.String name)
|
java.util.Vector<Property> |
getPropertyVector()
|
java.util.Vector<UniqueIdentifier> |
getRelatedIdentifiers()
Returns all related identifiers, a Vector
of UniqueIdentifier :s. |
static Properties |
load(java.lang.String fileName)
Loads a Properties-object from a file with the specified file name. |
static Properties |
loadXML(org.xml.sax.InputSource source)
Loads a Properties-object from an java.io.InputSource . |
static void |
printDTD(java.io.PrintWriter pw)
Prints the complete DTD of a Properties-XML-file to a PrintWriter . |
void |
printEvaluationToWriter(java.io.Writer w)
OLD |
static void |
printPartDTD(java.io.PrintWriter pw)
Prints the DTD of a Properties-XML-file to a PrintWriter . |
void |
printPartXML(java.io.PrintWriter pw)
|
static void |
printPropertiesXSLReference(java.io.PrintWriter pw)
Prints a reference to the Properties-XSL-file to a PrintWriter . |
void |
printXML(java.io.PrintWriter pw)
Prints the Properties to a PrintWriter . |
void |
printXSL(java.io.PrintWriter pw)
Prints a basic XSL-file for Properties XML-files to a PrintWriter . |
boolean |
sameOwnerIdentifier(Properties ps)
Returns true if this and ps has the same owner-object as decided by their owner identifier, an UniqueIdentifier . |
boolean |
sameRelatedIdentifiers(Properties ps)
Returns true if this and ps has the same related identifiers ( UniqueIdentifier -objects). |
void |
save(java.lang.String fileName)
Saves a Properties-object to a file with the specified file name. |
void |
setOwnerIdentifier(UniqueIdentifier ownerIdentifier)
Set the owner identifier to the specified UniqueIdentifier . |
void |
setProperty(java.lang.String name,
java.lang.Object value)
Sets a Property with the given name to the given value. |
int |
size()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Properties(java.lang.String name)
public Properties(java.lang.String name, UniqueIdentifier ownerIdentifier)
public Properties(Properties ps) throws PropertyNameConflictException
PropertyNameConflictException
Method Detail |
---|
public void addProperty(Property p) throws PropertyNameConflictException
Property
(or a PropertyGroup
) to the Properties.
PropertyNameConflictException
public PropertyGroup getPropertyGroup(java.lang.String propertyGroupName)
PropertyGroup
with the specified name.
null if it doesn't exist.
public Property getProperty(java.lang.String name)
Property
with the specified name.
null if it doesn't exist.
public void setProperty(java.lang.String name, java.lang.Object value) throws PropertyNotFoundException
PropertyNotFoundException
is thrown.
PropertyNotFoundException
public java.lang.Object getPropertyValue(java.lang.String name)
public java.lang.String getAppropriateValueDescription(java.lang.String name)
public java.util.Vector<Property> getPropertyVector()
public UniqueIdentifier getOwnerIdentifier()
UniqueIdentifier
).
public void setOwnerIdentifier(UniqueIdentifier ownerIdentifier)
UniqueIdentifier
.
public void addRelatedIdentifier(UniqueIdentifier relatedIdentifier)
UniqueIdentifier
as a related identifier.
public java.util.Vector<UniqueIdentifier> getRelatedIdentifiers()
Vector
of UniqueIdentifier
:s.
public java.lang.String getPropertiesName()
public int size()
public boolean sameOwnerIdentifier(Properties ps)
UniqueIdentifier
. False otherwise.
public boolean sameRelatedIdentifiers(Properties ps)
UniqueIdentifier
-objects). False otherwise.
If both Properties has no related identifiers true is returned.
public void save(java.lang.String fileName)
public static void printDTD(java.io.PrintWriter pw) throws java.io.IOException
PrintWriter
.
java.io.IOException
public static void printPartDTD(java.io.PrintWriter pw) throws java.io.IOException
PrintWriter
. Only the elements.
This method may be used when the Properties-XML should
be part of a larger XML.
java.io.IOException
public static void printPropertiesXSLReference(java.io.PrintWriter pw) throws java.io.IOException
PrintWriter
.
java.io.IOException
public void printXML(java.io.PrintWriter pw) throws java.io.IOException
PrintWriter
.
java.io.IOException
public void printPartXML(java.io.PrintWriter pw) throws java.io.IOException
java.io.IOException
public void printXSL(java.io.PrintWriter pw) throws java.io.IOException
PrintWriter
.
java.io.IOException
public static Properties load(java.lang.String fileName)
public static Properties loadXML(org.xml.sax.InputSource source)
java.io.InputSource
.
public void printEvaluationToWriter(java.io.Writer w) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |