toolbox.beangen
Class BeanCreationHelper

Package class diagram package BeanCreationHelper
java.lang.Object
  extended by toolbox.beangen.BeanCreationHelper

public class BeanCreationHelper
extends java.lang.Object

Helper class to handle all Java Reflection method invocations during Java Bean Creation.


Method Summary
static void setBeanProperties(java.lang.Object instance, java.util.Map props)
          Populate the Java Bean instance using the given Map as the values of the bean properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

setBeanProperties

public static void setBeanProperties(java.lang.Object instance,
                                     java.util.Map props)
                              throws java.lang.Exception
Populate the Java Bean instance using the given Map as the values of the bean properties.

Property mappings are done using Java Reflection and is performed as follows:

The keys in the Map are used as the names of the bean properties. If the Map contains a key with the value name it will be translated into a method call that will invoke the setName(...) method on the target bean using the value associated with the key in the Map.

Parameters:
instance - The bean instance.
props - Map containing bean properties.
Throws:
java.lang.Exception - if the bean cannot be created.