org.apache.myfaces.orchestra.dynaForm.metadata.impl
Class MetaDataImpl

java.lang.Object
  extended by org.apache.myfaces.orchestra.dynaForm.metadata.impl.MetaDataImpl
All Implemented Interfaces:
MetaData, MetaDataWritable

public class MetaDataImpl
extends Object
implements MetaDataWritable

A convenience implementation of the MetaDataWritable interface.

An instance of this type can be created and then passed to a list of one or more Extractor objects, together with a source object to be introspected. The extractor instances deduce information about fields of the source object and then add or update MetaField objects held by the MetaDataImpl.

The resulting populated object is then typically cast to the read-only MetaData interface type and passed to objects that make use of the gathered metadata, such as dynaform "gui builders".


Constructor Summary
MetaDataImpl()
           
 
Method Summary
 MetaField getField(String name)
          get the field by name
 int getFieldCount()
          number of fields
 String[] getFieldNames()
          get all fields names
 org.apache.myfaces.orchestra.dynaForm.metadata.impl.MetaFieldImpl getOrCreateField(String name)
          Add a new field to the metadata or return one if one already exists for the given name
 Set<String> getRequestedFields()
           
 boolean isParentOfWantedField(String name)
          Is metadata about this field wanted because some child field of this field has explicitly been marked as requested?
 boolean isWantedField(String name)
          Indicates whether metadata about this field is wanted.
 Iterator<String> iterFieldNames()
          iterate through fields
 void requestField(String name)
          Allow a field to be added to this object even after this MetaData object is "locked" for field addition.
 boolean setLockFields(boolean lockFields)
          if set to true this avoids any field to be newly created, only already existent fields are to be processed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MetaDataImpl

public MetaDataImpl()
Method Detail

isWantedField

public boolean isWantedField(String name)
Indicates whether metadata about this field is wanted.

If this object is not "locked", then this always returns true.

Even when locked, this returns true if:

Specified by:
isWantedField in interface MetaDataWritable
See Also:
setLockFields(boolean)

isParentOfWantedField

public boolean isParentOfWantedField(String name)
Is metadata about this field wanted because some child field of this field has explicitly been marked as requested?

Specified by:
isParentOfWantedField in interface MetaDataWritable
Returns:
true if the given name is the parent of one of the requestedFields
See Also:
#processField(String), setLockFields(boolean)

requestField

public void requestField(String name)
Allow a field to be added to this object even after this MetaData object is "locked" for field addition.

This is used when traversing the object graph for linked entities.

When a name like "foo.bar.baz" is passed to this method, the requestedFieldsParent list has "foo" and "foo.bar" added to it.

Specified by:
requestField in interface MetaDataWritable

getRequestedFields

public Set<String> getRequestedFields()
Specified by:
getRequestedFields in interface MetaDataWritable

getOrCreateField

public org.apache.myfaces.orchestra.dynaForm.metadata.impl.MetaFieldImpl getOrCreateField(String name)
Add a new field to the metadata or return one if one already exists for the given name

Specified by:
getOrCreateField in interface MetaDataWritable

getFieldCount

public int getFieldCount()
Description copied from interface: MetaData
number of fields

Specified by:
getFieldCount in interface MetaData
Specified by:
getFieldCount in interface MetaDataWritable

iterFieldNames

public Iterator<String> iterFieldNames()
Description copied from interface: MetaData
iterate through fields

Specified by:
iterFieldNames in interface MetaData
Specified by:
iterFieldNames in interface MetaDataWritable

getField

public MetaField getField(String name)
Description copied from interface: MetaData
get the field by name

Specified by:
getField in interface MetaData
Specified by:
getField in interface MetaDataWritable

getFieldNames

public String[] getFieldNames()
Description copied from interface: MetaData
get all fields names

Specified by:
getFieldNames in interface MetaData
Specified by:
getFieldNames in interface MetaDataWritable

setLockFields

public boolean setLockFields(boolean lockFields)
if set to true this avoids any field to be newly created, only already existent fields are to be processed

Specified by:
setLockFields in interface MetaDataWritable


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.