org.apache.commons.beanutils
Class ConvertingWrapDynaBean

java.lang.Object
  |
  +--org.apache.commons.beanutils.WrapDynaBean
        |
        +--org.apache.commons.beanutils.ConvertingWrapDynaBean
All Implemented Interfaces:
DynaBean

public class ConvertingWrapDynaBean
extends WrapDynaBean

Implementation of DynaBean that wraps a standard JavaBean instance, so that DynaBean APIs can be used to access its properties, though this implementation allows type conversion to occur when properties are set. This means that (say) Strings can be passed in as values in setter methods and this DynaBean will convert them to the correct primitive data types.

IMPLEMENTATION NOTE - This implementation does not support the contains() and remove() methods.

Version:
$Revision: 1.3 $ $Date: 2002/01/23 22:35:58 $
Author:
James Strachan

Field Summary
 
Fields inherited from class org.apache.commons.beanutils.WrapDynaBean
dynaClass, instance
 
Constructor Summary
ConvertingWrapDynaBean(java.lang.Object instance)
          Construct a new DynaBean associated with the specified JavaBean instance.
 
Method Summary
 void set(java.lang.String name, java.lang.Object value)
          Set the value of the property with the specified name performing any type conversions if necessary.
 
Methods inherited from class org.apache.commons.beanutils.WrapDynaBean
contains, get, get, get, getDynaClass, getDynaProperty, getInstance, remove, set, set
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConvertingWrapDynaBean

public ConvertingWrapDynaBean(java.lang.Object instance)
Construct a new DynaBean associated with the specified JavaBean instance.

Parameters:
instance - JavaBean instance to be wrapped
Method Detail

set

public void set(java.lang.String name,
                java.lang.Object value)
Set the value of the property with the specified name performing any type conversions if necessary. So this method can accept String values for primitive numeric data types for example.

Specified by:
set in interface DynaBean
Overrides:
set in class WrapDynaBean
Parameters:
name - Name of the property whose value is to be set
value - Value to which this property is to be set
Throws:
ConversionException - if the specified value cannot be converted to the type required for this property
java.lang.IllegalArgumentException - if there is no property of the specified name
java.lang.NullPointerException - if an attempt is made to set a primitive property to null


Copyright (c) 2001-2004 - Apache Software Foundation