Coverage Report - org.apache.tapestry.valid.ValidationConstraint
 
Classes in this File Line Coverage Branch Coverage Complexity
ValidationConstraint
0%
0/16
N/A
1
 
 1  
 // Copyright 2004, 2005 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package org.apache.tapestry.valid;
 16  
 
 17  
 import java.io.Serializable;
 18  
 
 19  
 /**
 20  
  * Defines an enumeration of different types of validation constraints that may be violated.
 21  
  * 
 22  
  * @author Howard Lewis Ship
 23  
  */
 24  
 
 25  
 public class ValidationConstraint implements Serializable
 26  
 {
 27  
     /**
 28  
      * Indicates that no value (or a value consisting only of white space) was provided for a field
 29  
      * that requires a non-null value.
 30  
      */
 31  
 
 32  0
     public static final ValidationConstraint REQUIRED = new ValidationConstraint("REQUIRED");
 33  
 
 34  
     /**
 35  
      * Indicates that a non-null value was provided, but that (after removing leading and trailing
 36  
      * whitespace), the value was not long enough.
 37  
      */
 38  
 
 39  0
     public static final ValidationConstraint MINIMUM_WIDTH = new ValidationConstraint(
 40  
             "MINIMUM_WIDTH");
 41  
 
 42  
     /**
 43  
      * Indicates that a non-null value was provided, but that (after removing leading and trailing
 44  
      * whitespace), the value was too long.
 45  
      */
 46  
 
 47  0
     public static final ValidationConstraint MAXIMUM_WIDTH = new ValidationConstraint(
 48  
             "MAXIMUM_WIDTH");
 49  
 
 50  
     /**
 51  
      * Indicates a general error in converting a String into a Date.
 52  
      */
 53  
 
 54  0
     public static final ValidationConstraint DATE_FORMAT = new ValidationConstraint("DATE_FORMAT");
 55  
 
 56  
     /**
 57  
      * Indicates a general error in the format of a string that is to be interpreted as a email.
 58  
      */
 59  
 
 60  0
     public static final ValidationConstraint EMAIL_FORMAT = new ValidationConstraint("EMAIL_FORMAT");
 61  
 
 62  
     /**
 63  
      * Indicates a general error in the format of a string that is to be interpreted as a number.
 64  
      */
 65  
 
 66  0
     public static final ValidationConstraint NUMBER_FORMAT = new ValidationConstraint("NUMBER_FORMAT");
 67  
 
 68  
     /**
 69  
      * Indicates that the value was too small (for a Date, too early).
 70  
      */
 71  
 
 72  0
     public static final ValidationConstraint TOO_SMALL = new ValidationConstraint("TOO_SMALL");
 73  
 
 74  
     /**
 75  
      * Indicates that the value was too large (for a Date, too late).
 76  
      */
 77  
 
 78  0
     public static final ValidationConstraint TOO_LARGE = new ValidationConstraint("TOO_LARGE");
 79  
 
 80  
     /**
 81  
      * Indicates an error in a string that does not fulfill a pattern.
 82  
      * 
 83  
      * @since 3.0
 84  
      */
 85  
 
 86  0
     public static final ValidationConstraint PATTERN_MISMATCH = new ValidationConstraint(
 87  
             "PATTERN_MISMATCH");
 88  
 
 89  
     /**
 90  
      * Indicates a consistency error, usually between too different fields.
 91  
      * 
 92  
      * @since 3.0
 93  
      */
 94  
 
 95  0
     public static final ValidationConstraint CONSISTENCY = new ValidationConstraint("CONSISTENCY");
 96  
 
 97  
     /**
 98  
      * Indicates that a URL is not of the correct format.
 99  
      * 
 100  
      * @since 3.0
 101  
      */
 102  
 
 103  0
     public static final ValidationConstraint URL_FORMAT = new ValidationConstraint("URL_FORMAT");
 104  
 
 105  
     /**
 106  
      * Indicates that the URL does not use one of the specified protocols.
 107  
      * 
 108  
      * @since 3.0
 109  
      */
 110  
 
 111  0
     public static final ValidationConstraint DISALLOWED_PROTOCOL = new ValidationConstraint(
 112  
             "DISALLOWED_PROTOCOL");
 113  
 
 114  
     private static final long serialVersionUID = 371593028205311930L;
 115  
     
 116  
     private final String _name;
 117  
 
 118  
     /**
 119  
      * Protected constructor, which allows new constraints to be created as subclasses.
 120  
      */
 121  
 
 122  
     protected ValidationConstraint(String name)
 123  0
     {
 124  0
         _name = name;
 125  0
     }
 126  
 
 127  
     public String toString()
 128  
     {
 129  0
         return "ValidationConstraint[" + _name + "]";
 130  
     }
 131  
 }