Package org.apache.openjpa.lib.util
Class ParameterTemplate
- java.lang.Object
 - 
- org.apache.openjpa.lib.util.ParameterTemplate
 
 
- 
public class ParameterTemplate extends Object
A template that allows parameter substitutions. Parameters should be placed in the template in the form ${param-name}. Use thesetParameter(java.lang.String, java.lang.Object)method to set the parameter values, which will be substituted into the template on calls towrite(java.io.OutputStream)andtoString(). If a parameter is encountered that hasn't been set, then the parameter key is used to lookup the corresponding System property.- Author:
 - Abe White
 
 
- 
- 
Constructor Summary
Constructors Constructor Description ParameterTemplate() 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ParameterTemplateappend(boolean value)Add the given value to the internal template.ParameterTemplateappend(char value)Add the given value to the internal template.ParameterTemplateappend(double value)Add the given value to the internal template.ParameterTemplateappend(float value)Add the given value to the internal template.ParameterTemplateappend(int value)Add the given value to the internal template.ParameterTemplateappend(long value)Add the given value to the internal template.ParameterTemplateappend(short value)Add the given value to the internal template.ParameterTemplateappend(File file)Add the given value to the internal template.ParameterTemplateappend(InputStream in)Add the given value to the internal template.ParameterTemplateappend(Reader reader)Add the given value to the internal template.ParameterTemplateappend(Object value)Add the given value to the internal template.ParameterTemplateappend(String value)Add the given value to the internal template.voidclearParameters()Clear the recorded parameter values.ObjectgetParameter(String name)Return the value set for the given parameter.booleanhasParameter(String name)Return true if the given parameter has been given a value.ObjectsetParameter(String name, Object val)Set the value for the given parameter.voidsetParameters(Map params)Set the values for all the parameters in the given map.StringtoString()Return a copy of the internal value template with all parameters substituted with their current values.voidwrite(File file)Write the internal value template with all parameters substituted with their current values.voidwrite(OutputStream out)Write the internal value template with all parameters substituted with their current values.voidwrite(Writer writer)Write the internal value template with all parameters substituted with their current values. 
 - 
 
- 
- 
Method Detail
- 
append
public ParameterTemplate append(String value)
Add the given value to the internal template. 
- 
append
public ParameterTemplate append(boolean value)
Add the given value to the internal template. 
- 
append
public ParameterTemplate append(char value)
Add the given value to the internal template. 
- 
append
public ParameterTemplate append(double value)
Add the given value to the internal template. 
- 
append
public ParameterTemplate append(float value)
Add the given value to the internal template. 
- 
append
public ParameterTemplate append(int value)
Add the given value to the internal template. 
- 
append
public ParameterTemplate append(long value)
Add the given value to the internal template. 
- 
append
public ParameterTemplate append(short value)
Add the given value to the internal template. 
- 
append
public ParameterTemplate append(Object value)
Add the given value to the internal template. 
- 
append
public ParameterTemplate append(InputStream in) throws IOException
Add the given value to the internal template.- Throws:
 IOException
 
- 
append
public ParameterTemplate append(Reader reader) throws IOException
Add the given value to the internal template.- Throws:
 IOException
 
- 
append
public ParameterTemplate append(File file) throws IOException
Add the given value to the internal template.- Throws:
 IOException
 
- 
hasParameter
public boolean hasParameter(String name)
Return true if the given parameter has been given a value. 
- 
setParameter
public Object setParameter(String name, Object val)
Set the value for the given parameter. 
- 
setParameters
public void setParameters(Map params)
Set the values for all the parameters in the given map. 
- 
clearParameters
public void clearParameters()
Clear the recorded parameter values. 
- 
toString
public String toString()
Return a copy of the internal value template with all parameters substituted with their current values. 
- 
write
public void write(OutputStream out) throws IOException
Write the internal value template with all parameters substituted with their current values.- Throws:
 IOException
 
- 
write
public void write(Writer writer) throws IOException
Write the internal value template with all parameters substituted with their current values.- Throws:
 IOException
 
- 
write
public void write(File file) throws IOException
Write the internal value template with all parameters substituted with their current values.- Throws:
 IOException
 
 - 
 
 -