com.commsen.apropos.core
Class Property

java.lang.Object
  extended by com.commsen.apropos.core.Property
All Implemented Interfaces:
java.lang.Cloneable

public class Property
extends java.lang.Object
implements java.lang.Cloneable

This class represents property. In APropOS a property is a very simple object having name, value, description and group it belongs to.

Author:
Milen Dyankov

Constructor Summary
Property(java.lang.String name)
          Creates new property with given name
Property(java.lang.String name, java.lang.String value, java.lang.String description, java.lang.String group)
          Creates new property object and sets all fields with appropriate values
 
Method Summary
 java.lang.Object clone()
          
 boolean equals(java.lang.Object obj)
          Returns true if obj.name.equals(name)
 java.lang.String getDescription()
           
 java.lang.String getGroup()
           
 java.lang.String getName()
           
 java.lang.String getValue()
           
 int hashCode()
          Returns hashCode based on name to conform to modified equals(Object) method.
 boolean sameAs(Property property)
          Checks if given property is the same as the one represented by this object.
 void setDescription(java.lang.String description)
           
 void setGroup(java.lang.String group)
           
 void setName(java.lang.String name)
           
 void setValue(java.lang.String value)
           
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Property

public Property(java.lang.String name)
         throws PropertiesException
Creates new property with given name

Parameters:
name - the name of the property
Throws:
PropertiesException - if name is null or blank

Property

public Property(java.lang.String name,
                java.lang.String value,
                java.lang.String description,
                java.lang.String group)
         throws PropertiesException
Creates new property object and sets all fields with appropriate values

Parameters:
name - the property name
value - the property value
description - the property description
group - the group this property belongs to
Throws:
PropertiesException - if name is null or blank
Method Detail

sameAs

public boolean sameAs(Property property)
Checks if given property is the same as the one represented by this object. This method will return true if ALL fields have exactly the same values and false otherwise

Parameters:
property - the property to compare
Returns:
true if both object have exactly the same values in all fields and false otherwise

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException

Overrides:
clone in class java.lang.Object
Throws:
java.lang.CloneNotSupportedException

equals

public boolean equals(java.lang.Object obj)
Returns true if obj.name.equals(name)

Overrides:
equals in class java.lang.Object
See Also:
Object.equals(java.lang.Object)

hashCode

public int hashCode()
Returns hashCode based on name to conform to modified equals(Object) method.

Overrides:
hashCode in class java.lang.Object
See Also:
Object.hashCode()

getName

public java.lang.String getName()
Returns:
the name

setName

public void setName(java.lang.String name)
             throws PropertiesException
Parameters:
name - the name of the property
Throws:
PropertiesException - if name is null or blank

getValue

public java.lang.String getValue()
Returns:
the value

setValue

public void setValue(java.lang.String value)
Parameters:
value - the value to set

getDescription

public java.lang.String getDescription()
Returns:
the description

setDescription

public void setDescription(java.lang.String description)
Parameters:
description - the description to set

getGroup

public java.lang.String getGroup()
Returns:
the group

setGroup

public void setGroup(java.lang.String group)
Parameters:
group - the group to set


Copyright © 2008 Commsen International. All Rights Reserved.