|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.util.extensions.xml.VariableConverter
public class VariableConverter
A value converter that can be used on all setter methods
that has been annotated with the VariableSetter
annotation. The input string will be scanned for
parts that match $VARIABLE$
and have that part
replaced by the actual value of a defined variable. Undefined
variables are not replaced. See setVariable(String, String)
for more details.
Web client note! The web client application defines the variables
ROOT
and HOME
which are the paths to
the web application root directory (/base2
) and the
home directory (/base2/extensions/xxxx
) of the current
extension. This means that the XML configuration file may
contain values like $ROOT$/images/copy.gif
. The
$ROOT$
portion will automatically be replaced with the
correct path if the factory method is annotated with the VariableSetter
annotation.
Field Summary | |
---|---|
private static Pattern |
VARIABLE
|
private Map<String,String> |
variables
|
Constructor Summary | |
---|---|
VariableConverter()
Create a new variable converter. |
Method Summary | |
---|---|
String |
convert(String in,
Method method)
Convert a value. |
String |
getVariable(String name)
Get the value of a variable. |
void |
setVariable(String name,
String value)
Set the value of a variable. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Pattern VARIABLE
private Map<String,String> variables
Constructor Detail |
---|
public VariableConverter()
setVariable(String, String)
to define variables and XmlLoader.addValueConverter(ValueConverter)
to register this converter with an XML loader.
Method Detail |
---|
public String convert(String in, Method method)
ValueConverter
convert
in interface ValueConverter
in
- The value to convertmethod
- The factory setter method
public void setVariable(String name, String value)
ActionFactory
or RendererFactory
) is annotated with the
VariableSetter
annotation the
XML loader will scan the value from the XML file for replacement
tags, $VARIABLE$
, and replace the tag with the value
of the variable. If the variable doesn't exists, the tag is left
untouched.
name
- The name of the variablevalue
- The value of the variable, or null to remove
the variablepublic String getVariable(String name)
name
- The variable's name
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |