View Javadoc
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 public Object toObject(IField field, String value) throws ValidatorException { 13 if (value==null) { 14 return null; 15 } 16 if (!value.startsWith("/")) { 17 throw new ValidatorException("Invalid " + field.getBinding("displayName").getString(), null, value); 18 } 19 return value; 20 } 21 22 /*** 23 * @see net.sf.tapestry.valid.IValidator#toString(IField, Object) 24 */ 25 public String toString(IField field, Object value) { 26 return (String)value; 27 } 28 29 }

This page was automatically generated by Maven