org.appfuse.util
Class ConvertUtil

java.lang.Object
  extended byorg.appfuse.util.ConvertUtil

public final class ConvertUtil
extends Object

Utility class to convert one object to another.

View Source

Version:
$Revision: 1.1 $ $Date: 2004/03/31 13:04:17 $
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 convertDates(Object obj, Object form)
          This method loops through all the Date methods and formats them for the UI.
static Object convertLists(Object o)
          Convenience method to convert Lists (in a Form) from POJOs to Forms.
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

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

convertDates

public static Object convertDates(Object obj,
                                  Object form)
This method loops through all the Date methods and formats them for the UI.

Parameters:
obj -
form -
Returns:
a Form for the web

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:
Throws:
Exception


Copyright © 2002-2004