org.progeeks.meta.view
Class DefaultMetaForm

java.lang.Object
  extended by org.progeeks.meta.view.DefaultMetaForm
All Implemented Interfaces:
MetaForm

public class DefaultMetaForm
extends java.lang.Object
implements MetaForm

Default implementation of MetaForm that works from a list of PropertyInfo objects. This is primarily to make subclasses easier to write and to provide an "identity" MetaForm implementation. Right now this MetaForm implementation is mutable so that it can be more easily configured. Still up in the air whether or not forms will be mutable in the long run so I'm not making this Fixable.

Version:
$Revision: 1.3 $
Author:
Paul Speed

Field Summary
 
Fields inherited from interface org.progeeks.meta.view.MetaForm
FORM_ANNOTATION
 
Constructor Summary
DefaultMetaForm()
          Creates an uninitialized MetaForm.
DefaultMetaForm(MetaClass metaClass, java.util.List names)
          Creates a meta-form for the specified class and property names.
DefaultMetaForm(java.lang.String className, java.util.List names)
          Creates a meta-form for the specified class and property infos.
 
Method Summary
 MetaClass getMetaClass()
          Returns the meta-class to which this form is associated.
 java.lang.String getMetaClassName()
          Returns the meta-class name associated with this form.
 int getPropertyCount()
          Returns the number of properties in this form.
 PropertyInfo getPropertyInfo(int index)
          Returns a PropertyInfo object for the specified index.
 PropertyMutator getPropertyMutator(MetaObject target, int index)
          Returns a PropertyMutator from the specified MetaObject for the specified index.
 java.util.List getPropertyNames()
          Returns the list of property names provided by this form.
protected  boolean isValidProperty(java.lang.String name)
          Returns true if the specified name is a valid property name.
 void setMetaClass(MetaClass metaClass)
          Sets the meta-class for this form.
 void setMetaClassName(java.lang.String name)
          Sets the meta-class by name.
 void setPropertyNames(java.util.List names)
          Sets the names and order of properties to be included in this form.
 java.lang.String toString()
           
protected  void validateProperties()
          Called to validate the list of names against the associated meta-class if both exist.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultMetaForm

public DefaultMetaForm()
Creates an uninitialized MetaForm.


DefaultMetaForm

public DefaultMetaForm(MetaClass metaClass,
                       java.util.List names)
Creates a meta-form for the specified class and property names.


DefaultMetaForm

public DefaultMetaForm(java.lang.String className,
                       java.util.List names)
Creates a meta-form for the specified class and property infos. The specified class name is used to lookup a meta-class using MetaClass.forName().

Method Detail

setMetaClass

public void setMetaClass(MetaClass metaClass)
Sets the meta-class for this form.


getMetaClass

public MetaClass getMetaClass()
Returns the meta-class to which this form is associated.

Specified by:
getMetaClass in interface MetaForm

setMetaClassName

public void setMetaClassName(java.lang.String name)
Sets the meta-class by name. The string specified is used to lookup the metaclass by calling MetaClass.forName().


getMetaClassName

public java.lang.String getMetaClassName()
Returns the meta-class name associated with this form. Primarily provided for bean property symmetry.


setPropertyNames

public void setPropertyNames(java.util.List names)
Sets the names and order of properties to be included in this form.


getPropertyNames

public java.util.List getPropertyNames()
Returns the list of property names provided by this form.

Specified by:
getPropertyNames in interface MetaForm

getPropertyCount

public int getPropertyCount()
Returns the number of properties in this form.

Specified by:
getPropertyCount in interface MetaForm

getPropertyInfo

public PropertyInfo getPropertyInfo(int index)
Returns a PropertyInfo object for the specified index.

Specified by:
getPropertyInfo in interface MetaForm

getPropertyMutator

public PropertyMutator getPropertyMutator(MetaObject target,
                                          int index)
Returns a PropertyMutator from the specified MetaObject for the specified index.

Specified by:
getPropertyMutator in interface MetaForm

isValidProperty

protected boolean isValidProperty(java.lang.String name)
Returns true if the specified name is a valid property name. Default implementation returns getMetaClass().hasProperty(name).


validateProperties

protected void validateProperties()
Called to validate the list of names against the associated meta-class if both exist.


toString

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


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