de.bea.domingo.map
Class BaseDMapper

java.lang.Object
  extended by de.bea.domingo.map.BaseDMapper
All Implemented Interfaces:
Mapper
Direct Known Subclasses:
ConstantMapper, CustomMapper, DirectMapper, ListMapper, MapMapper, MapperSet

public abstract class BaseDMapper
extends java.lang.Object
implements Mapper

Abstract base class for domingo mappers providing useful methods to access Notes. Converts DNotesRuntimeExceptions into MappingExceptions.

Author:
Kurt Riede

Constructor Summary
BaseDMapper()
          Constructor.
 
Method Summary
protected  java.util.Calendar getCalendar(java.lang.Object calendarOrList)
          Returns a calendar if the given object is a calendar or it is a list and the first element in the list is a calendar.
protected  java.util.List getValue(DDocument document, java.lang.String itemName)
          Reads the date value of an item.
protected  java.lang.Object getValue(java.lang.Object object, java.lang.String getName)
          Returns the value of an attribute given by its getter method from given object.
protected  java.util.Calendar getValueDate(DDocument document, java.lang.String itemName)
          Reads the date value of an item.
protected  DDateRange getValueDateRange(DDocument document, java.lang.String itemName)
          Reads the DDateRange value of an item.
protected  java.lang.Double getValueDouble(DDocument document, java.lang.String itemName)
          Reads the Double value of an item.
protected  java.lang.Integer getValueInteger(DDocument document, java.lang.String itemName)
          Reads the Integer value of an item.
protected  java.lang.String getValueString(DDocument document, java.lang.String itemName)
          Reads the String value of an item.
protected static boolean hasMethod(java.lang.Class clazz, java.lang.String name)
          Checks if a class contains a method with the specified name and no arguments.
protected  void replaceItemValue(DDocument document, java.lang.String itemName, java.util.Calendar value)
          Replaces the value of an item with a Calendar.
protected  void replaceItemValue(DDocument document, java.lang.String itemName, double value)
          Replaces the value of an item with a double.
protected  void replaceItemValue(DDocument document, java.lang.String itemName, java.lang.Double value)
          Replaces the value of an item with a Double.
protected  void replaceItemValue(DDocument document, java.lang.String itemName, int value)
          Replaces the value of an item with an int.
protected  void replaceItemValue(DDocument document, java.lang.String itemName, java.lang.Integer value)
          Replaces the value of an item with an Integer.
protected  void replaceItemValue(DDocument document, java.lang.String itemName, java.util.List value)
          Replaces the value of an item with a List.
protected  void replaceItemValue(DDocument document, java.lang.String itemName, java.lang.String value)
          Replaces the value of an item with a String.
protected  void setValue(java.lang.Object object, java.lang.String setName, java.lang.Object value, java.lang.Class clazz)
          Sets a value of an attribute given by its setter method in a given object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface de.bea.domingo.map.Mapper
map, map
 

Constructor Detail

BaseDMapper

public BaseDMapper()
Constructor.

Method Detail

replaceItemValue

protected final void replaceItemValue(DDocument document,
                                      java.lang.String itemName,
                                      java.lang.String value)
                               throws MappingException
Replaces the value of an item with a String.

Parameters:
document - document to replace item in
itemName - name of item to replace
value - the value to map
Throws:
MappingException - if the value cannot be mapped to the item

replaceItemValue

protected final void replaceItemValue(DDocument document,
                                      java.lang.String itemName,
                                      java.util.Calendar value)
                               throws MappingException
Replaces the value of an item with a Calendar.

Parameters:
document - document to replace item in
itemName - name of item to replace
value - the value to map
Throws:
MappingException - if the value cannot be mapped to the item

replaceItemValue

protected final void replaceItemValue(DDocument document,
                                      java.lang.String itemName,
                                      int value)
                               throws MappingException
Replaces the value of an item with an int.

Parameters:
document - document to replace item in
itemName - name of item to replace
value - the value to map
Throws:
MappingException - if the value cannot be mapped to the item

replaceItemValue

protected final void replaceItemValue(DDocument document,
                                      java.lang.String itemName,
                                      java.lang.Integer value)
                               throws MappingException
Replaces the value of an item with an Integer.

Parameters:
document - document to replace item in
itemName - name of item to replace
value - the value to map
Throws:
MappingException - if the value cannot be mapped to the item

replaceItemValue

protected final void replaceItemValue(DDocument document,
                                      java.lang.String itemName,
                                      double value)
                               throws MappingException
Replaces the value of an item with a double.

Parameters:
document - document to replace item in
itemName - name of item to replace
value - the value to map
Throws:
MappingException - if the value cannot be mapped to the item

replaceItemValue

protected final void replaceItemValue(DDocument document,
                                      java.lang.String itemName,
                                      java.lang.Double value)
                               throws MappingException
Replaces the value of an item with a Double.

Parameters:
document - document to replace item in
itemName - name of item to replace
value - the value to map
Throws:
MappingException - if the value cannot be mapped to the item

replaceItemValue

protected final void replaceItemValue(DDocument document,
                                      java.lang.String itemName,
                                      java.util.List value)
                               throws MappingException
Replaces the value of an item with a List.

Parameters:
document - document to replace item in
itemName - name of item to replace
value - the value to map
Throws:
MappingException - if the value cannot be mapped to the item

getValueDate

protected final java.util.Calendar getValueDate(DDocument document,
                                                java.lang.String itemName)
                                         throws MappingException
Reads the date value of an item.

Parameters:
document - the domingo document to read from
itemName - the name of the item to read from
Returns:
value of item as Calendar
Throws:
MappingException - if the value cannot be read

getValueDateRange

protected final DDateRange getValueDateRange(DDocument document,
                                             java.lang.String itemName)
                                      throws MappingException
Reads the DDateRange value of an item.

Parameters:
document - the domingo document to read from
itemName - the name of the item to read from
Returns:
value of item as DDateRange
Throws:
MappingException - if the value cannot be read

getValueString

protected final java.lang.String getValueString(DDocument document,
                                                java.lang.String itemName)
                                         throws MappingException
Reads the String value of an item.

Parameters:
document - the domingo document to read from
itemName - the name of the item to read from
Returns:
value of item as String
Throws:
MappingException - if the value cannot be read

getValueDouble

protected final java.lang.Double getValueDouble(DDocument document,
                                                java.lang.String itemName)
                                         throws MappingException
Reads the Double value of an item.

Parameters:
document - the domingo document to read from
itemName - the name of the item to read from
Returns:
value of item as Double
Throws:
MappingException - if the value cannot be read

getValueInteger

protected final java.lang.Integer getValueInteger(DDocument document,
                                                  java.lang.String itemName)
                                           throws MappingException
Reads the Integer value of an item.

Parameters:
document - the domingo document to read from
itemName - the name of the item to read from
Returns:
value of item as Integer
Throws:
MappingException - if the value cannot be read

getValue

protected final java.util.List getValue(DDocument document,
                                        java.lang.String itemName)
                                 throws MappingException
Reads the date value of an item.

Parameters:
document - the domingo document to read from
itemName - the name of the item to read from
Returns:
value of item as Calendar
Throws:
MappingException - if the value cannot be read

getCalendar

protected final java.util.Calendar getCalendar(java.lang.Object calendarOrList)
Returns a calendar if the given object is a calendar or it is a list and the first element in the list is a calendar.

Parameters:
calendarOrList - a Calendar or a List
Returns:
Calendar or null

getValue

protected final java.lang.Object getValue(java.lang.Object object,
                                          java.lang.String getName)
                                   throws MappingException
Returns the value of an attribute given by its getter method from given object.

Parameters:
object - the object
getName - the name of the getter method
Returns:
the value
Throws:
MappingException - if the given attribute cannot be accessed

setValue

protected final void setValue(java.lang.Object object,
                              java.lang.String setName,
                              java.lang.Object value,
                              java.lang.Class clazz)
                       throws MappingException
Sets a value of an attribute given by its setter method in a given object.

Parameters:
object - the object
setName - the name of the setter method
value - the value to set
clazz - class name of attribute
Throws:
MappingException - if the given attribute cannot be accessed

hasMethod

protected static final boolean hasMethod(java.lang.Class clazz,
                                         java.lang.String name)
Checks if a class contains a method with the specified name and no arguments.

Parameters:
clazz - the class to check
name - a method name
Returns:
true if the method exists, else false


Domingo Java-API