com.metamatrix.common.object
Class ObjectDefinitionImpl

java.lang.Object
  extended by com.metamatrix.common.object.ObjectDefinitionImpl
All Implemented Interfaces:
ObjectDefinition, PropertiedObject, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable
Direct Known Subclasses:
CallbackImpl, FileDefinitionImpl, FolderDefinitionImpl, PermissionDataNodeDefinitionImpl, PropertyDefinitionGroup, PropertyDefinitionImpl

public class ObjectDefinitionImpl
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable, java.lang.Cloneable, ObjectDefinition

This class captures the definition of a generic property, and can be used to determine appropriate user-interface representations to present and capture property values.

See Also:
Serialized Form

Constructor Summary
ObjectDefinitionImpl()
          Create an empty property definition object with all defaults.
ObjectDefinitionImpl(ObjectDefinition defn)
          Create a property definition object that is a copy of the specified instance.
ObjectDefinitionImpl(java.lang.String name)
          Create a definition object with the specified set of attributes.
ObjectDefinitionImpl(java.lang.String name, java.lang.String displayName)
          Create a definition object with the specified set of attributes.
 
Method Summary
 java.lang.Object clone()
           
 int compareTo(java.lang.Object obj)
          Compares this object to another.
 void computeDisplayName()
          This method attempts to compute and set the display name using the name, which is expected to be in "humpback" notation (e.g., "aName").
 void computePluralDisplayName()
          This method attempts to compute and set the plural display name from the display name, using a simple pluralization rules.
 boolean equals(java.lang.Object obj)
          Returns true if the specified object is semantically equal to this instance.
 java.lang.String getDisplayName()
          Get the localized display name of this property.
 java.lang.String getName()
          Get the actual or programmatic name of this property.
 java.lang.String getPluralDisplayName()
          Get the localized display name of this property.
 java.lang.String getShortDescription()
          Get the short description of this property.
 java.lang.String getShortDisplayName()
          Get the localized display name of this property.
 int hashCode()
          Returns the hash code value for this object.
 void setDisplayName(java.lang.String displayName)
          Set the localized display name of this property.
 void setName(java.lang.String name)
          Set the actual or programmatic name of this property.
 void setPluralDisplayName(java.lang.String displayName)
          Set the localized display name of this property.
 void setShortDescription(java.lang.String shortDescription)
          Set the short description of this property.
 void setShortDisplayName(java.lang.String displayName)
          Set the localized display name of this property.
 java.lang.String toString()
          Returns a string representing the current state of the object.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectDefinitionImpl

public ObjectDefinitionImpl()
Create an empty property definition object with all defaults.


ObjectDefinitionImpl

public ObjectDefinitionImpl(java.lang.String name)
Create a definition object with the specified set of attributes.

Parameters:
name - the name
displayName - the displayable name for this property; or null if the display name is the same as the property name.
multiplicity - the instance of Multiplicity that captures the allowable range of the cardinality of property values; if null, the default multiplicity of "1" is used.

ObjectDefinitionImpl

public ObjectDefinitionImpl(java.lang.String name,
                            java.lang.String displayName)
Create a definition object with the specified set of attributes.

Parameters:
name - the name
displayName - the displayable name for this property; or null if the display name is the same as the property name.

ObjectDefinitionImpl

public ObjectDefinitionImpl(ObjectDefinition defn)
Create a property definition object that is a copy of the specified instance.

Parameters:
defn - the definition that is to be copied; may not be null
Method Detail

getName

public java.lang.String getName()
Get the actual or programmatic name of this property.

Specified by:
getName in interface ObjectDefinition
Returns:
the property's name (never null)

setName

public void setName(java.lang.String name)
Set the actual or programmatic name of this property.

Parameters:
name - the new property name; or null if there is no name for this property definition

getPluralDisplayName

public java.lang.String getPluralDisplayName()
Get the localized display name of this property.

Specified by:
getPluralDisplayName in interface ObjectDefinition
Returns:
the displayable name for this property (never null)

setPluralDisplayName

public void setPluralDisplayName(java.lang.String displayName)
Set the localized display name of this property.

Parameters:
displayName - the displayable name for this property; or null if the display name is the same as the property name.

getShortDisplayName

public java.lang.String getShortDisplayName()
Get the localized display name of this property.

Specified by:
getShortDisplayName in interface ObjectDefinition
Returns:
the displayable name for this property (never null)

setShortDisplayName

public void setShortDisplayName(java.lang.String displayName)
Set the localized display name of this property.

Parameters:
displayName - the displayable name for this property; or null if the display name is the same as the property name.

getDisplayName

public java.lang.String getDisplayName()
Get the localized display name of this property.

Specified by:
getDisplayName in interface ObjectDefinition
Returns:
the displayable name for this property (never null)

setDisplayName

public void setDisplayName(java.lang.String displayName)
Set the localized display name of this property.

Parameters:
displayName - the displayable name for this property; or null if the display name is the same as the property name.

getShortDescription

public java.lang.String getShortDescription()
Get the short description of this property.

Specified by:
getShortDescription in interface ObjectDefinition
Returns:
the short description for this property (never null)

setShortDescription

public void setShortDescription(java.lang.String shortDescription)
Set the short description of this property.

Parameters:
shortDescription - the short description for this property, or null if there is no short description.

compareTo

public int compareTo(java.lang.Object obj)
Compares this object to another. If the specified object is an instance of the MetaMatrixSessionID class, then this method compares the contents; otherwise, it throws a ClassCastException (as instances are comparable only to instances of the same class).

Note: this method is consistent with equals(), meaning that (compare(x, y)==0) == (x.equals(y)).

Specified by:
compareTo in interface ObjectDefinition
Specified by:
compareTo in interface java.lang.Comparable
Parameters:
obj - the object that this instance is to be compared to.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object, respectively.
Throws:
java.lang.IllegalArgumentException - if the specified object reference is null
java.lang.ClassCastException - if the specified object's type prevents it from being compared to this instance.

equals

public boolean equals(java.lang.Object obj)
Returns true if the specified object is semantically equal to this instance. Note: this method is consistent with compareTo().

Specified by:
equals in interface ObjectDefinition
Overrides:
equals in class java.lang.Object
Parameters:
obj - the object that this instance is to be compared to.
Returns:
whether the object is equal to this object.

hashCode

public int hashCode()
Returns the hash code value for this object.

Overrides:
hashCode in class java.lang.Object
Returns:
a hash code value for this object.

toString

public java.lang.String toString()
Returns a string representing the current state of the object.

Specified by:
toString in interface ObjectDefinition
Overrides:
toString in class java.lang.Object
Returns:
the string representation of this instance.

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

computeDisplayName

public void computeDisplayName()
This method attempts to compute and set the display name using the name, which is expected to be in "humpback" notation (e.g., "aName"). Note that this implementation is not expected to work in all situations.

This method first ensures that the first character is uppercase. Then, the method inserts before any remaining uppercase characters a space.


computePluralDisplayName

public void computePluralDisplayName()
This method attempts to compute and set the plural display name from the display name, using a simple pluralization rules. Note that this implementation is not expected to work in all situations.

Pluralization rules are as follows: <

  • Strings ending in -ss are appended with "es".
  • Strings ending in -y will have the y replaced with "ies".
  • All other Strings will be appended with "s".


  • Copyright © 2009. All Rights Reserved.