org.xulux.api.dataprovider
Interface IDataProvider


public interface IDataProvider

The dataprovider interface.

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

Method Summary
 void addMapping(IMapping mapping)
          Add a mapping to the dataprovider
 IMapping createMapping(java.lang.Object object)
          Create a new mapping for this dataprovider based on the object passed in.
 IConverter getConverter(java.lang.Object object)
          Get the specified converter
Converters are a special case : they are part of the core system of xulux and therefor in the interface.
 IMapping getMapping(java.lang.Object object)
           
 java.util.Map getMappings()
           
 java.lang.Object getValue(java.lang.Object mapping, java.lang.String field, java.lang.Object object)
          A convenience method, so you can get values on the highest possible level
 void initialize()
          After processing the dictionary xml files (so if all properties are set initialize is called to interpret the properties.
 boolean needsPartValue()
           
 void setProperty(java.lang.String key, java.lang.String value)
          Sets the properties of the driver.
 java.lang.Object setValue(java.lang.Object mapping, java.lang.String field, java.lang.Object object, java.lang.Object value)
          A convenience method, so you can set values on the highest possible level
 

Method Detail

getMappings

java.util.Map getMappings()
Returns:
the current mappings (in cache) that are known to the dataprovider

getMapping

IMapping getMapping(java.lang.Object object)
Parameters:
object - the object. The dataprovider should determine what it accepts.
Returns:
the mapping for the specified object

setProperty

void setProperty(java.lang.String key,
                 java.lang.String value)
Sets the properties of the driver. All elements in the properties element in the dictionary xml. eg.
 <properties>
   <bean>org.xulux.dataprovider.ParameteredBean</bean>
    <fields>
      <field name="value"/>
    </fields>
 </properties>
 
This xml will result in calls to setProperty like this : setProperty("bean", "org.xulux.dataprovider.ParameteredBean"); setProperty("fields.field.name", "value");

Parameters:
key - the key
value - the value

initialize

void initialize()
After processing the dictionary xml files (so if all properties are set initialize is called to interpret the properties.


addMapping

void addMapping(IMapping mapping)
Add a mapping to the dataprovider

Parameters:
mapping -

setValue

java.lang.Object setValue(java.lang.Object mapping,
                          java.lang.String field,
                          java.lang.Object object,
                          java.lang.Object value)
A convenience method, so you can set values on the highest possible level

Parameters:
mapping - the mapping to use (could be a string or the current part / field value)
field - the field name to use
object - the object to use. If null the provider will try to create the object
value - the value to set in the object
Returns:
the object in the changed form, or if object was null, the newly created object. if an error occured of somekind, it should be logged and the value null should be returned.

getValue

java.lang.Object getValue(java.lang.Object mapping,
                          java.lang.String field,
                          java.lang.Object object)
A convenience method, so you can get values on the highest possible level

Parameters:
mapping - the mapping to use (could be a string or the current part / field value)
field - the field name to use
object - the object to use. If null the provider will try to create the object
Returns:
the object, or nul when an error occurred or the value is null.

needsPartValue

boolean needsPartValue()
Returns:
Specifies if the dataprovider needs the partvalue to function correctly

getConverter

IConverter getConverter(java.lang.Object object)
Get the specified converter
Converters are a special case : they are part of the core system of xulux and therefor in the interface. However they are just added like any other property, using setProperty

Parameters:
object - the object to get the converter for
Returns:
the converter

createMapping

IMapping createMapping(java.lang.Object object)
Create a new mapping for this dataprovider based on the object passed in.

Parameters:
object - the object to create the mapping from or for
Returns:
the mapping


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