|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.mybatchfwk.utils.PropertiesLoader
public class PropertiesLoader
The PropertiesLoader class is used to load a configuration from a file, and initialize all the fields of an object using the annotations.
| Constructor Summary | |
|---|---|
PropertiesLoader(java.util.Properties properties)
|
|
| Method Summary | |
|---|---|
void |
addProperty(java.lang.String key,
java.lang.String value)
Add the given property |
void |
assignProperties(java.lang.Object object)
Assign the configuration properties to an object using the annotations. |
boolean |
getBooleanProperty(java.lang.String key)
Retrieve a boolean from a string property |
java.text.DateFormat |
getDateFormat()
|
java.util.Date |
getDateProperty(java.lang.String key)
Retrieve a date from a string property |
int |
getIntegerProperty(java.lang.String key)
Retrieve an integer from a string property |
long |
getLongProperty(java.lang.String key)
Retrieve a long from a string property |
java.util.Properties |
getProperties()
|
static java.util.Properties |
getProperties(java.lang.String fileName)
Load properties stored into a properties configuration file |
java.lang.String |
getProperty(java.lang.String key)
Return the property designed by the given key |
static java.lang.reflect.Field[] |
getPropertyFields(java.lang.Class clazz)
Return the fields that owns an annotation of type Property |
short |
getShortProperty(java.lang.String key)
Retrieve a short from a string property |
void |
setDateFormat(java.text.DateFormat dateFormat)
|
void |
setProperties(java.util.Properties properties)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PropertiesLoader(java.util.Properties properties)
properties - | Method Detail |
|---|
public static java.util.Properties getProperties(java.lang.String fileName)
throws java.io.IOException
java.io.IOException - if the configuration file cannot be find into the classpath or if it cannot be parsed (not a properties file)public static java.lang.reflect.Field[] getPropertyFields(java.lang.Class clazz)
clazz -
public void assignProperties(java.lang.Object object)
throws java.lang.IllegalArgumentException,
java.lang.IllegalAccessException,
java.text.ParseException
object -
java.lang.IllegalArgumentException
java.lang.IllegalAccessException
java.text.ParseExceptionpublic boolean getBooleanProperty(java.lang.String key)
key -
public int getIntegerProperty(java.lang.String key)
key -
public short getShortProperty(java.lang.String key)
key -
public long getLongProperty(java.lang.String key)
key -
public java.util.Date getDateProperty(java.lang.String key)
throws java.text.ParseException
key -
java.text.ParseExceptionpublic java.lang.String getProperty(java.lang.String key)
key -
public void addProperty(java.lang.String key,
java.lang.String value)
key - value - public java.text.DateFormat getDateFormat()
public void setDateFormat(java.text.DateFormat dateFormat)
dateFormat - the dateFormat to setpublic java.util.Properties getProperties()
public void setProperties(java.util.Properties properties)
properties - the properties to set
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||