|
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.PathConverter
public class PathConverter
A value converter that can be used on all setter methods
that has been annotated with the PathSetter
and
PathType
annotations. The values are converted using the
following rules:
/images/copy.gif --> /base2/images/copy.gif
.
~/images/myimage.png --> /base2/extensions/my-extensions.jar/images/myimage.png
PathType.CONTEXT_RELATIVE
the context-path is
removed from the final path. Eg. /base2/images/copy.gif --> /images/copy.gif
Note 1! It is only the start of the value that is checked. If a '~' is present in the middle of a value, it is not replaced.
Note 2! Using the VariableSetter
annotation and values like
$ROOT$/images/copy.gif
would have the same result. The only
reason to use this annotation is that it allows for a shorter notation.
Field Summary | |
---|---|
private String |
home
|
private String |
root
|
Constructor Summary | |
---|---|
PathConverter()
Create a new empty path converter. |
|
PathConverter(String root,
String home)
Create a new initialised path converter. |
Method Summary | |
---|---|
String |
convert(String in,
Method method)
Convert a value. |
String |
getHome()
Get the value of the home path. |
String |
getRoot()
Get the value of the root path. |
void |
setHome(String home)
Set the value of the home path. |
void |
setRoot(String root)
Set the value of the root path. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private String root
private String home
Constructor Detail |
---|
public PathConverter()
setRoot(String)
and setHome(String)
to initialise it.
public PathConverter(String root, String home)
root
- The path to the root directory (/)home
- The path to the home directory (~)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 setRoot(String root)
public String getRoot()
public void setHome(String home)
public String getHome()
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |