|
|||||||||||||||||||
| This license of Clover is provided to support the development of Flock only. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover. | |||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| PathValidator.java | 0% | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
package net.sf.flock.webapp.components; |
|
| 2 |
|
|
| 3 |
import net.sf.tapestry.valid.BaseValidator; |
|
| 4 |
import net.sf.tapestry.valid.IField; |
|
| 5 |
import net.sf.tapestry.valid.ValidatorException; |
|
| 6 |
|
|
| 7 |
public class PathValidator extends BaseValidator {
|
|
| 8 |
|
|
| 9 |
/** |
|
| 10 |
* @see net.sf.tapestry.valid.IValidator#toObject(IField, String) |
|
| 11 |
*/ |
|
| 12 | 0 |
public Object toObject(IField field, String value) throws ValidatorException {
|
| 13 | 0 |
if (value==null) {
|
| 14 | 0 |
return null; |
| 15 |
} |
|
| 16 | 0 |
if (!value.startsWith("/")) {
|
| 17 | 0 |
throw new ValidatorException("Invalid " + field.getBinding("displayName").getString(), null, value);
|
| 18 |
} |
|
| 19 | 0 |
return value; |
| 20 |
} |
|
| 21 |
|
|
| 22 |
/** |
|
| 23 |
* @see net.sf.tapestry.valid.IValidator#toString(IField, Object) |
|
| 24 |
*/ |
|
| 25 | 0 |
public String toString(IField field, Object value) {
|
| 26 | 0 |
return (String)value; |
| 27 |
} |
|
| 28 |
|
|
| 29 |
} |
|
| 30 |
|
|
||||||||||