Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.commons.beanutils
Class WrapDynaBean  view WrapDynaBean download WrapDynaBean.java

java.lang.Object
  extended byorg.apache.commons.beanutils.WrapDynaBean
All Implemented Interfaces:
DynaBean
Direct Known Subclasses:
ConvertingWrapDynaBean

public class WrapDynaBean
extends java.lang.Object
implements DynaBean

Implementation of DynaBean that wraps a standard JavaBean instance, so that DynaBean APIs can be used to access its properties.

The most common use cases for this class involve wrapping an existing java bean. (This makes it different from the typical use cases for other DynaBean's.) For example:

  Object aJavaBean = ...;
  ...
  DynaBean db = new WrapDynaBean(aJavaBean);
  ...
 

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

Version:
$Revision: 1.9 $ $Date: 2004/02/28 13:18:34 $

Field Summary
protected  WrapDynaClass dynaClass
          The DynaClass "base class" that this DynaBean is associated with.
protected  java.lang.Object instance
          The JavaBean instance wrapped by this WrapDynaBean.
 
Constructor Summary
WrapDynaBean(java.lang.Object instance)
          Construct a new DynaBean associated with the specified JavaBean instance.
 
Method Summary
 boolean contains(java.lang.String name, java.lang.String key)
          Does the specified mapped property contain a value for the specified key value?
 java.lang.Object get(java.lang.String name)
          Return the value of a simple property with the specified name.
 java.lang.Object get(java.lang.String name, int index)
          Return the value of an indexed property with the specified name.
 java.lang.Object get(java.lang.String name, java.lang.String key)
          Return the value of a mapped property with the specified name, or null if there is no value for the specified key.
 DynaClass getDynaClass()
          Return the DynaClass instance that describes the set of properties available for this DynaBean.
protected  DynaProperty getDynaProperty(java.lang.String name)
          Return the property descriptor for the specified property name.
 java.lang.Object getInstance()
          Gets the bean instance wrapped by this DynaBean.
 void remove(java.lang.String name, java.lang.String key)
          Remove any existing value for the specified key on the specified mapped property.
 void set(java.lang.String name, int index, java.lang.Object value)
          Set the value of an indexed property with the specified name.
 void set(java.lang.String name, java.lang.Object value)
          Set the value of a simple property with the specified name.
 void set(java.lang.String name, java.lang.String key, java.lang.Object value)
          Set the value of a mapped property with the specified name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dynaClass

protected WrapDynaClass dynaClass
The DynaClass "base class" that this DynaBean is associated with.


instance

protected java.lang.Object instance
The JavaBean instance wrapped by this WrapDynaBean.

Constructor Detail

WrapDynaBean

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

Method Detail

contains

public boolean contains(java.lang.String name,
                        java.lang.String key)
Does the specified mapped property contain a value for the specified key value?

Specified by:
contains in interface DynaBean

get

public java.lang.Object get(java.lang.String name)
Return the value of a simple property with the specified name.

Specified by:
get in interface DynaBean

get

public java.lang.Object get(java.lang.String name,
                            int index)
Return the value of an indexed property with the specified name.

Specified by:
get in interface DynaBean

get

public java.lang.Object get(java.lang.String name,
                            java.lang.String key)
Return the value of a mapped property with the specified name, or null if there is no value for the specified key.

Specified by:
get in interface DynaBean

getDynaClass

public DynaClass getDynaClass()
Return the DynaClass instance that describes the set of properties available for this DynaBean.

Specified by:
getDynaClass in interface DynaBean

remove

public void remove(java.lang.String name,
                   java.lang.String key)
Remove any existing value for the specified key on the specified mapped property.

Specified by:
remove in interface DynaBean

set

public void set(java.lang.String name,
                java.lang.Object value)
Set the value of a simple property with the specified name.

Specified by:
set in interface DynaBean

set

public void set(java.lang.String name,
                int index,
                java.lang.Object value)
Set the value of an indexed property with the specified name.

Specified by:
set in interface DynaBean

set

public void set(java.lang.String name,
                java.lang.String key,
                java.lang.Object value)
Set the value of a mapped property with the specified name.

Specified by:
set in interface DynaBean

getInstance

public java.lang.Object getInstance()
Gets the bean instance wrapped by this DynaBean. For most common use cases, this object should already be known and this method safely be ignored. But some creators of frameworks using DynaBean's may find this useful.


getDynaProperty

protected DynaProperty getDynaProperty(java.lang.String name)
Return the property descriptor for the specified property name.