|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ca.intelliware.amakihi.util.property.PropertiesManager
This class provides some standard utilities for getting and using properties associated with a class.
Method Summary | |
static PropertiesManager |
getInstance()
|
java.util.Properties |
getProperties(java.lang.Class aClass,
java.lang.String resourceName)
|
java.util.Properties |
getProperties(java.lang.Object obj,
java.lang.String resourceName)
|
void |
initializeBeanFrom(java.lang.Object bean,
java.util.Properties properties)
This method introspects a Java Bean and for all writeable bean properties, it looks in the provided properties file to get a value which will be used to set the property. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public java.util.Properties getProperties(java.lang.Class aClass, java.lang.String resourceName)
public static PropertiesManager getInstance()
public void initializeBeanFrom(java.lang.Object bean, java.util.Properties properties) throws InitializeFromPropertiesException
Suppose the Java Bean had three properties:
This method will look in the properties file for each of these properties
and will then call the appropriate set methods (setLastName()
,
setFirstName()
, and setBankBalance()
).
To handle the bankBalance (and other non-String classes), this method
will look for a constructor that takes a String parameter, and perform the
equivalent of new BigDecimal("12345.67")
.
This method knows how to handle the standard primitive types; an
int
property, for example, will be set by first calling the
new Integer(propertyValueAsString)
constructor of the object
type.
public java.util.Properties getProperties(java.lang.Object obj, java.lang.String resourceName)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |