org.progeeks.meta
Class PropertyInfo

java.lang.Object
  extended by org.progeeks.meta.PropertyInfo
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable, Fixable
Direct Known Subclasses:
ContainerPropertyInfo

public class PropertyInfo
extends java.lang.Object
implements Fixable, java.io.Serializable, java.lang.Comparable

Describes the characteristics of a single property. This provides additional info that is useful to all or most forms of rendering/editing.

Version:
$Revision: 1.15 $
Author:
Paul Speed
See Also:
Serialized Form

Field Summary
static int ALIGN_CENTER
           
static int ALIGN_LEFT
           
static int ALIGN_RIGHT
           
 
Constructor Summary
PropertyInfo()
          Creates an empty and unfixed property info suitable for bean-like property loading.
PropertyInfo(PropertyInfo info, PropertyType type)
           
PropertyInfo(java.lang.String propertyName, PropertyInfo info)
           
PropertyInfo(java.lang.String propertyName, java.lang.String name, PropertyType type)
           
PropertyInfo(java.lang.String propertyName, java.lang.String name, java.lang.String shortName, PropertyType type)
           
PropertyInfo(java.lang.String propertyName, java.lang.String name, java.lang.String shortName, java.lang.String description, PropertyType type, int alignment, boolean writable)
           
PropertyInfo(java.lang.String propertyName, java.lang.String name, java.lang.String shortName, java.lang.String description, PropertyType type, int alignment, boolean writable, boolean readable)
           
PropertyInfo(java.lang.String propertyName, java.lang.String name, java.lang.String shortName, java.lang.String description, PropertyType type, java.lang.Object defaultValue, int alignment, boolean writable, boolean readable)
           
 
Method Summary
 int compareTo(java.lang.Object o)
           
 boolean equals(java.lang.Object obj)
           
 boolean equals(PropertyInfo obj)
           
 java.lang.Object getDefaultValue()
          Returns the default value for this property or null if no default value has been defined.
 java.lang.String getDescription()
          Returns a short description of the property.
 java.lang.String getName()
          Returns a name that can be used in normal sized UI components or renderers.
 int getPropertyAlignment()
          Returns the preferred alignment for this property.
 java.lang.String getPropertyName()
          Returns the name of this property as would be used to access the actual value in the meta-object.
 PropertyType getPropertyType()
          Returns the type of this property.
 java.lang.String getShortName()
          Returns a name that can be used in limited-space situations like table headers, etc..
static java.lang.String getSplitName(java.lang.String name)
          Attempts to break up a property name up based on letter case and runs of upper case letters.
 int hashCode()
           
 boolean isFixed()
          Returns true if this object cannot be modified.
 boolean isReadable()
          Returns true if this property can be read.
 boolean isWritable()
          Returns true if this property can be updated.
 PropertyInfo replacePropertyName(java.lang.String name)
          Clones this property info, replacing the property name with the name specified.
 PropertyInfo replacePropertyType(PropertyType type)
          Clones this property info, replacing the property type with the type specified.
 void setDefaultValue(java.lang.Object defaultValue)
          Sets the default value for this property.
 void setDescription(java.lang.String description)
          Sets the short description of the property.
 void setFixed(boolean fixed)
          Sets the mutable/immutable state of this object.
 void setName(java.lang.String name)
          Sets the displayable version of the property name.
 void setPropertyAlignment(int alignment)
          Sets the alignment of this property.
 void setPropertyName(java.lang.String name)
          Sets the property name this PropertyInfo represents.
 void setPropertyType(PropertyType type)
          Sets the type of this property.
 void setReadable(boolean readable)
          Sets the redability of this property.
 void setShortName(java.lang.String name)
          Sets the short displayable version of the property name.
 void setWritable(boolean writable)
          Sets the writability of this property.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ALIGN_CENTER

public static final int ALIGN_CENTER
See Also:
Constant Field Values

ALIGN_LEFT

public static final int ALIGN_LEFT
See Also:
Constant Field Values

ALIGN_RIGHT

public static final int ALIGN_RIGHT
See Also:
Constant Field Values
Constructor Detail

PropertyInfo

public PropertyInfo()
Creates an empty and unfixed property info suitable for bean-like property loading.


PropertyInfo

public PropertyInfo(java.lang.String propertyName,
                    java.lang.String name,
                    java.lang.String shortName,
                    java.lang.String description,
                    PropertyType type,
                    int alignment,
                    boolean writable,
                    boolean readable)

PropertyInfo

public PropertyInfo(java.lang.String propertyName,
                    java.lang.String name,
                    java.lang.String shortName,
                    java.lang.String description,
                    PropertyType type,
                    java.lang.Object defaultValue,
                    int alignment,
                    boolean writable,
                    boolean readable)

PropertyInfo

public PropertyInfo(java.lang.String propertyName,
                    java.lang.String name,
                    java.lang.String shortName,
                    java.lang.String description,
                    PropertyType type,
                    int alignment,
                    boolean writable)

PropertyInfo

public PropertyInfo(java.lang.String propertyName,
                    java.lang.String name,
                    PropertyType type)

PropertyInfo

public PropertyInfo(java.lang.String propertyName,
                    java.lang.String name,
                    java.lang.String shortName,
                    PropertyType type)

PropertyInfo

public PropertyInfo(PropertyInfo info,
                    PropertyType type)

PropertyInfo

public PropertyInfo(java.lang.String propertyName,
                    PropertyInfo info)
Method Detail

replacePropertyType

public PropertyInfo replacePropertyType(PropertyType type)
Clones this property info, replacing the property type with the type specified.


replacePropertyName

public PropertyInfo replacePropertyName(java.lang.String name)
Clones this property info, replacing the property name with the name specified.


setFixed

public void setFixed(boolean fixed)
              throws IllegalModificationException
Sets the mutable/immutable state of this object. A value of true indicates that the object will be immutable after this call.

Specified by:
setFixed in interface Fixable
Throws:
IllegalModificationException - if the object does not support a specific mutability shift. For example, most immutable objects will not allow setFixed( false ).

isFixed

public boolean isFixed()
Returns true if this object cannot be modified.

Specified by:
isFixed in interface Fixable

getSplitName

public static java.lang.String getSplitName(java.lang.String name)
Attempts to break up a property name up based on letter case and runs of upper case letters.


setPropertyName

public void setPropertyName(java.lang.String name)
Sets the property name this PropertyInfo represents. Calls to this method are only allowed if isFixed() returns false.


getPropertyName

public java.lang.String getPropertyName()
Returns the name of this property as would be used to access the actual value in the meta-object.


setShortName

public void setShortName(java.lang.String name)
Sets the short displayable version of the property name. Calls to this method are only allowed if isFixed() returns false.


getShortName

public java.lang.String getShortName()
Returns a name that can be used in limited-space situations like table headers, etc..


setName

public void setName(java.lang.String name)
Sets the displayable version of the property name. Calls to this method are only allowed if isFixed() returns false.


getName

public java.lang.String getName()
Returns a name that can be used in normal sized UI components or renderers.


setDescription

public void setDescription(java.lang.String description)
Sets the short description of the property. Calls to this method are only allowed if isFixed() returns false.


getDescription

public java.lang.String getDescription()
Returns a short description of the property. This is useful for fly-overs or other simple help information.


setPropertyType

public void setPropertyType(PropertyType type)
Sets the type of this property. Calls to this method are only allowed if isFixed() returns false.


getPropertyType

public PropertyType getPropertyType()
Returns the type of this property.


setDefaultValue

public void setDefaultValue(java.lang.Object defaultValue)
Sets the default value for this property. This is both optional at class definition time and optional for the MetaObject implementations to use. It is an attempt to better define this property for use in UIs and in MetaObject implementations for which default values are not a natural part of the base storage. For example, a BeanMetaObject will defer to the bean itself for defaults while MapMetaObject will get its defaults right from these property info objects.


getDefaultValue

public java.lang.Object getDefaultValue()
Returns the default value for this property or null if no default value has been defined. It is up to meta-object implementers whether or not null is considered a default value too, but generally a null is "ground state" for most properties anyway. Check with the specific MetaObject implementation for its policy in this regard.


setPropertyAlignment

public void setPropertyAlignment(int alignment)
Sets the alignment of this property. Calls to this method are only allowed if isFixed() returns false.


getPropertyAlignment

public int getPropertyAlignment()
Returns the preferred alignment for this property.


setReadable

public void setReadable(boolean readable)
Sets the redability of this property. Calls to this method are only allowed if isFixed() returns false. Defaults to true if not set.


isReadable

public boolean isReadable()
Returns true if this property can be read.


setWritable

public void setWritable(boolean writable)
Sets the writability of this property. Calls to this method are only allowed if isFixed() returns false.


isWritable

public boolean isWritable()
Returns true if this property can be updated.


hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(PropertyInfo obj)

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2002-2003 Paul Speed. All Rights Reserved.