Package org.apache.velocity.texen.util
Class PropertiesUtil
- java.lang.Object
-
- org.apache.velocity.texen.util.PropertiesUtil
-
public class PropertiesUtil extends java.lang.Object
A property utility class for the texen text/code generator Usually this class is only used from a Velocity context.- Version:
- $Id: PropertiesUtil.java 510628 2007-02-22 19:07:59Z nbubna $
- Author:
- Leon Messerschmidt, Stephane Bailliez
-
-
Constructor Summary
Constructors Constructor Description PropertiesUtil()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.Properties
load(java.lang.String propertiesFile)
Load properties from either a file in the templatePath if there is one or the classPath.protected java.util.Properties
loadFromClassPath(java.lang.String propertiesName)
Load a properties file from the classpathprotected java.util.Properties
loadFromTemplatePath(java.lang.String propertiesFile)
Load a properties file from the templatePath defined in the generator.
-
-
-
Method Detail
-
load
public java.util.Properties load(java.lang.String propertiesFile)
Load properties from either a file in the templatePath if there is one or the classPath.- Parameters:
propertiesFile
- the properties file to load through either the templatePath or the classpath.- Returns:
- a properties instance filled with the properties found in the file or an empty instance if no file was found.
-
loadFromTemplatePath
protected java.util.Properties loadFromTemplatePath(java.lang.String propertiesFile) throws java.lang.Exception
Load a properties file from the templatePath defined in the generator. As the templatePath can contains multiple paths, it will cycle through them to find the file. The first file that can be successfully loaded is considered. (kind of like the java classpath), it is done to clone the Velocity process of loading templates.- Parameters:
propertiesFile
- the properties file to load. It must be a relative pathname.- Returns:
- a properties instance loaded with the properties from the file. If no file can be found it returns an empty instance.
- Throws:
java.lang.Exception
-
loadFromClassPath
protected java.util.Properties loadFromClassPath(java.lang.String propertiesName) throws java.lang.Exception
Load a properties file from the classpath- Parameters:
propertiesName
- the properties file to load.- Returns:
- a properties instance loaded with the properties from the file. If no file can be found it returns an empty instance.
- Throws:
java.lang.Exception
-
-