|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.kuali.student.common.util.PropertiesFactory
public class PropertiesFactory
A really freaking simple properties filter that returns a properties map for a subset of a properties file. Give this method the file name of the properties file, and then give it the prefix to filter on. The prefix gets a "." appended to it on filtering.
For example, if the properties are:
Field Summary | |
---|---|
(package private) Properties |
properties
|
Constructor Summary | |
---|---|
PropertiesFactory(File file)
This constructs a PropertiesFactory. |
|
PropertiesFactory(InputStream in)
This constructs a PropertiesFactory. |
|
PropertiesFactory(String filename)
This constructs a PropertiesFactory. |
Method Summary | |
---|---|
Map<Object,Object> |
getProperties(String prefix)
This method filters the properties based on the prefix given as described above. |
static Map<Object,Object> |
getProperties(String filename,
String prefix)
A static version of the properties filter. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
Properties properties
Constructor Detail |
---|
public PropertiesFactory(String filename) throws IOException
filename
- the filename of the properties file as determined by ClassLoader.getSystemResource(String)
.
IOException
public PropertiesFactory(File file) throws FileNotFoundException, IOException
file
- the properties file
FileNotFoundException
IOException
public PropertiesFactory(InputStream in) throws IOException
in
- an InputStream to read the properties from
IOException
Method Detail |
---|
public Map<Object,Object> getProperties(String prefix)
prefix
- the prefix to filter on
public static Map<Object,Object> getProperties(String filename, String prefix) throws IOException
<bean id="test" class="org.kuali.student.common.util.PropertiesFactory" factory-method="getProperties" >
<constructor-arg value="file.properties"/>
<constructor-arg value="prefix1"/>
</bean>
filename
- prefix
- the prefix to filter on
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |