2.17.2: 2011-06-17

net.sf.basedb.util.extensions.xml
Class PathConverter

java.lang.Object
  extended by net.sf.basedb.util.extensions.xml.PathConverter
All Implemented Interfaces:
ValueConverter

public class PathConverter
extends Object
implements ValueConverter

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:

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.

Version:
2.7
Author:
nicklas
Last modified
$Date:2008-03-20 12:15:25 +0100 (Thu, 20 Mar 2008) $

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

root

private String root

home

private String home
Constructor Detail

PathConverter

public PathConverter()
Create a new empty path converter. Use setRoot(String) and setHome(String) to initialise it.


PathConverter

public PathConverter(String root,
                     String home)
Create a new initialised path converter.

Parameters:
root - The path to the root directory (/)
home - The path to the home directory (~)
Method Detail

convert

public String convert(String in,
                      Method method)
Description copied from interface: ValueConverter
Convert a value.

Specified by:
convert in interface ValueConverter
Parameters:
in - The value to convert
method - The factory setter method
Returns:
The converted or original value

setRoot

public void setRoot(String root)
Set the value of the root path.


getRoot

public String getRoot()
Get the value of the root path.


setHome

public void setHome(String home)
Set the value of the home path.


getHome

public String getHome()
Get the value of the home path.


2.17.2: 2011-06-17