org.appfuse.util
Class ConvertUtil

java.lang.Object
  extended by org.appfuse.util.ConvertUtil

public final class ConvertUtil
extends Object

Utility class to convert one object to another.

View Source

Author:
Matt Raible

Constructor Summary
ConvertUtil()
           
 
Method Summary
static Object convert(Object o)
          Convenience method to convert a form to a POJO and back again
static Map convertBundleToMap(ResourceBundle rb)
          Method to convert a ResourceBundle to a Map object.
static Properties convertBundleToProperties(ResourceBundle rb)
          Method to convert a ResourceBundle to a Properties object.
static Object convertLists(Object o)
          Convenience method to convert Lists (in a Form) from POJOs to Forms.
static Map convertListToMap(List list)
           
static Object getOpposingObject(Object o)
          This method inspects a POJO or Form and figures out its pojo/form equivalent.
static Object populateObject(Object obj, ResourceBundle rb)
          Convenience method used by tests to populate an object from a ResourceBundle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConvertUtil

public ConvertUtil()
Method Detail

convertBundleToMap

public static Map convertBundleToMap(ResourceBundle rb)
Method to convert a ResourceBundle to a Map object.

Parameters:
rb - a given resource bundle
Returns:
Map a populated map

convertListToMap

public static Map convertListToMap(List list)

convertBundleToProperties

public static Properties convertBundleToProperties(ResourceBundle rb)
Method to convert a ResourceBundle to a Properties object.

Parameters:
rb - a given resource bundle
Returns:
Properties a populated properties object

populateObject

public static Object populateObject(Object obj,
                                    ResourceBundle rb)
Convenience method used by tests to populate an object from a ResourceBundle

Parameters:
obj - an initialized object
rb - a resource bundle
Returns:
a populated object

getOpposingObject

public static Object getOpposingObject(Object o)
                                throws ClassNotFoundException,
                                       InstantiationException,
                                       IllegalAccessException
This method inspects a POJO or Form and figures out its pojo/form equivalent.

Parameters:
o - the object to inspect
Returns:
the Class of the persistable object
Throws:
ClassNotFoundException
InstantiationException
IllegalAccessException

convert

public static Object convert(Object o)
                      throws Exception
Convenience method to convert a form to a POJO and back again

Parameters:
o - the object to tranfer properties from
Returns:
converted object
Throws:
Exception

convertLists

public static Object convertLists(Object o)
                           throws Exception
Convenience method to convert Lists (in a Form) from POJOs to Forms. Also checks for and formats dates.

Parameters:
o -
Returns:
Object with converted lists
Throws:
Exception


Copyright � 2002-2006