Clover coverage report - Code Coverage for tapestry release 4.0-alpha-3
Coverage timestamp: Mon May 16 2005 09:05:49 EDT
file stats: LOC: 78   Methods: 0
NCLOC: 13   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
IValidator.java - - - -
coverage
 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 org.apache.tapestry.IMarkupWriter;
 18   
 import org.apache.tapestry.IRequestCycle;
 19   
 import org.apache.tapestry.form.IFormComponent;
 20   
 
 21   
 /**
 22   
  *  An object that works with an {@link IFormComponent} to format output
 23   
  *  (convert object values to strings values) and to process input
 24   
  *  (convert strings to object values and validate them).
 25   
  *
 26   
  *  @author Howard Lewis Ship
 27   
  *  @since 1.0.8
 28   
  *
 29   
  **/
 30   
 
 31   
 public interface IValidator
 32   
 {
 33   
     /**
 34   
      *  All validators must implement a required property.  If true,
 35   
      *  the client must supply a non-null value.
 36   
      *
 37   
      **/
 38   
 
 39   
     public boolean isRequired();
 40   
 
 41   
     /**
 42   
      *  Invoked during rendering to convert an object value (which may be null)
 43   
      *  to a String.  It is acceptible to return null.  The string will be the
 44   
      *  VALUE attribute of the HTML text field.
 45   
      *
 46   
      **/
 47   
 
 48   
     public String toString(IFormComponent field, Object value);
 49   
 
 50   
     /**
 51   
      *  Converts input, submitted by the client, into an object value.
 52   
      *  May return null if the input is null (and the required flag is false).
 53   
      *
 54   
      *  <p>The input string will already have been trimmed.  It may be null.
 55   
      *
 56   
      *  @throws ValidatorException if the string cannot be converted into
 57   
      *  an object, or the object is
 58   
      *  not valid (due to other constraints).
 59   
      **/
 60   
 
 61   
     public Object toObject(IFormComponent field, String input) throws ValidatorException;
 62   
 
 63   
     /**
 64   
      *  Invoked by the field after it finishes rendering its tag (but before
 65   
      *  the tag is closed) to allow the validator to provide a contribution to the
 66   
      *  rendering process.  Validators typically generated client-side JavaScript
 67   
      *  to peform validation.
 68   
      *
 69   
      *  @since 2.2
 70   
      *
 71   
      **/
 72   
 
 73   
     public void renderValidatorContribution(
 74   
         IFormComponent field,
 75   
         IMarkupWriter writer,
 76   
         IRequestCycle cycle);
 77   
 
 78   
 }