org.xulux.dataprovider.bean
Class BeanMapping

java.lang.Object
  extended by org.xulux.dataprovider.bean.BeanMapping
All Implemented Interfaces:
org.xulux.api.dataprovider.IMapping

public class BeanMapping
extends java.lang.Object
implements org.xulux.api.dataprovider.IMapping

Contains the the Bean to Name mapping Every field in the mapping is represented by a BeanField

Version:
$Id: BeanMapping.java,v 1.1 2005/12/18 12:58:23 mvdb Exp $
Author:
Martin van den Bemt

Nested Class Summary
static class BeanMapping.FieldList
          Inner ArrayList with an overriden indexOf Which checks equals on the object In the arraylist instead of the object passed
 
Constructor Summary
BeanMapping()
          Constructor for BeanMapping.
BeanMapping(java.lang.String name)
          Creates a BeanMapping with the specified name
 
Method Summary
 void addField(org.xulux.api.dataprovider.IField f)
          Adds a field to the mapping
 org.xulux.api.dataprovider.IField createField(java.lang.Object object)
          Creates a beanfield based on the passed name If no beanField can be created based on the name null will be returned.
 void discover()
          Will discover the fields in the bean.
 void discover(java.lang.String field)
          Discovers a specific field, and ads it to the cache.
 boolean equals(java.lang.Object object)
           
 java.lang.Class getBean()
          Returns the bean.
 org.xulux.api.dataprovider.IDataProvider getDataProvider()
           
 org.xulux.api.dataprovider.IField getField(java.lang.Object f)
          This method will also search aliases of the field.
 java.util.List getFields()
           
 java.lang.String getName()
           
 java.lang.Object getValue(java.lang.String field, java.lang.Object object)
           
 boolean isDiscovery()
          Returns the discovery.
 void setBean(java.lang.Class bean)
          Sets the bean.
 void setDataProvider(BeanDataProvider dataProvider)
          Set the dataprovider.
 void setDiscovery(boolean discovery)
          Sets the discovery.
 void setName(java.lang.String name)
          Sets the BeanMapping name.
 void setProperty(java.lang.String name, java.lang.String value)
           
 java.lang.Object setValue(java.lang.String field, java.lang.Object object, java.lang.Object value)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BeanMapping

public BeanMapping()
Constructor for BeanMapping.


BeanMapping

public BeanMapping(java.lang.String name)
Creates a BeanMapping with the specified name

Parameters:
name - - the beanMapping name
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in interface org.xulux.api.dataprovider.IMapping
Returns:
the name of the beanMapping

setName

public void setName(java.lang.String name)
Sets the BeanMapping name.

Parameters:
name - The name to set

getBean

public java.lang.Class getBean()
Returns the bean.

Returns:
Class

setBean

public void setBean(java.lang.Class bean)
Sets the bean.

Parameters:
bean - The bean to set

isDiscovery

public boolean isDiscovery()
Returns the discovery.

Returns:
boolean

setDiscovery

public void setDiscovery(boolean discovery)
Sets the discovery.

Parameters:
discovery - The discovery to set

createField

public org.xulux.api.dataprovider.IField createField(java.lang.Object object)
Creates a beanfield based on the passed name If no beanField can be created based on the name null will be returned.

Specified by:
createField in interface org.xulux.api.dataprovider.IMapping
Parameters:
name - - the name of the field methods to discover.
Returns:
the beanfield with the specified name

addField

public void addField(org.xulux.api.dataprovider.IField f)
Adds a field to the mapping

Specified by:
addField in interface org.xulux.api.dataprovider.IMapping
Parameters:
f - - the field

getFields

public java.util.List getFields()
Specified by:
getFields in interface org.xulux.api.dataprovider.IMapping
Returns:
all the fields in an arraylist

getField

public org.xulux.api.dataprovider.IField getField(java.lang.Object f)
This method will also search aliases of the field.

Specified by:
getField in interface org.xulux.api.dataprovider.IMapping
See Also:
org.xulux.dataprovider.IMapping#getField(java.lang.Object)

discover

public void discover()
Will discover the fields in the bean. if discovery is set and discovery has not yet taken place. Discovery will methods which are private or protected. It will also try to discover the set method that is connected to the getter (assuming it is not a read only field).


discover

public void discover(java.lang.String field)
Discovers a specific field, and ads it to the cache.

Parameters:
field - the field to discover

equals

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

toString

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

setValue

public java.lang.Object setValue(java.lang.String field,
                                 java.lang.Object object,
                                 java.lang.Object value)
Specified by:
setValue in interface org.xulux.api.dataprovider.IMapping
See Also:
org.xulux.dataprovider.IMapping#setValue(java.lang.String, java.lang.Object, java.lang.Object)

getValue

public java.lang.Object getValue(java.lang.String field,
                                 java.lang.Object object)
Specified by:
getValue in interface org.xulux.api.dataprovider.IMapping
See Also:
org.xulux.dataprovider.IMapping#getValue(java.lang.String, java.lang.Object)

setDataProvider

public void setDataProvider(BeanDataProvider dataProvider)
Set the dataprovider.

Parameters:
dataProvider - the dataprovider

getDataProvider

public org.xulux.api.dataprovider.IDataProvider getDataProvider()
Specified by:
getDataProvider in interface org.xulux.api.dataprovider.IMapping
See Also:
IMapping.getDataProvider()

setProperty

public void setProperty(java.lang.String name,
                        java.lang.String value)
Specified by:
setProperty in interface org.xulux.api.dataprovider.IMapping
See Also:
IMapping.setProperty(java.lang.String, java.lang.String)


Copyright © 2006-2007 Martin van den Bemt. All Rights Reserved.