edu.usc.cse.desi.properties
Class PropertyHolder

java.lang.Object
  extended byedu.usc.cse.desi.properties.PropertyHolder
All Implemented Interfaces:
IObjectWithProperties, java.io.Serializable

public class PropertyHolder
extends java.lang.Object
implements IObjectWithProperties, java.io.Serializable

This class will contain the properties of an object with properties. In order for an object to have properties, it should contain an instance of this class. This class actually implements the IObjectWithProperties interface. This interface is otherwise only implemented by model objects with properties.

Author:
nbeckman Started on Jul 16, 2004
See Also:
Serialized Form

Field Summary
private  java.util.HashMap myProperties
           
 
Constructor Summary
private PropertyHolder()
           
  PropertyHolder(java.util.Map prop_mapping)
           
 
Method Summary
 java.util.Collection getProperties()
          This method returns a Collection of all the Propery objects for the given implementor.
 java.lang.String getPropertyDisplayName(java.lang.String prop_name)
          Properties, in addition to having values also have display names.
 java.lang.Object getPropertyValue(java.lang.String prop_name)
          This method should gets the given property.
 boolean hasProperty(java.lang.String prop_name)
          Checks to see if the object has the given property.
 void setPropertyValue(java.lang.String prop_name, java.lang.Object value)
          This method will set the given property with the given value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myProperties

private java.util.HashMap myProperties
Constructor Detail

PropertyHolder

private PropertyHolder()

PropertyHolder

public PropertyHolder(java.util.Map prop_mapping)
Method Detail

getPropertyDisplayName

public java.lang.String getPropertyDisplayName(java.lang.String prop_name)
                                        throws PropertyNotFoundException
Description copied from interface: IObjectWithProperties
Properties, in addition to having values also have display names. This method will return the display name for the given property.

Specified by:
getPropertyDisplayName in interface IObjectWithProperties
Parameters:
prop_name -
Returns:
Throws:
PropertyNotFoundException

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String prop_name)
                                  throws PropertyNotFoundException
Description copied from interface: IObjectWithProperties
This method should gets the given property. If the property does not exist, a PropertyNotFoundException is thrown.

Specified by:
getPropertyValue in interface IObjectWithProperties
Parameters:
prop_name - The name of the property to get.
Returns:
Object - The value of the given property.
Throws:
PropertyNotFoundException - Thrown if the given property does not exist for this type.

hasProperty

public boolean hasProperty(java.lang.String prop_name)
Description copied from interface: IObjectWithProperties
Checks to see if the object has the given property.

Specified by:
hasProperty in interface IObjectWithProperties
Parameters:
prop_name - String - The name of the property.
Returns:
true - This object has the given property. false - This object doesn't have the given property.

setPropertyValue

public void setPropertyValue(java.lang.String prop_name,
                             java.lang.Object value)
                      throws PropertyNotFoundException,
                             java.lang.ClassCastException
Description copied from interface: IObjectWithProperties
This method will set the given property with the given value. If the property does not exist, a PropertyNotFoundException is thrown. If the type of the value is not compatable with the type of the property, it throws a ClassCastException.

Specified by:
setPropertyValue in interface IObjectWithProperties
Parameters:
prop_name - String - The name of the proerty to be set.
value - Object - The value to set the property to.
Throws:
java.lang.ClassCastException - Thrown if there is a mismatch between the given value type and the type of the property.
PropertyNotFoundException - Thrown if this object doesn't have the given property.

getProperties

public java.util.Collection getProperties()
Description copied from interface: IObjectWithProperties
This method returns a Collection of all the Propery objects for the given implementor.

Specified by:
getProperties in interface IObjectWithProperties
Returns:
Collection - A Collection of Property Objects.