|
|||||||||||||||||||
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 | |||||||||||||||
ValidatorException.java | - | 85.7% | 80% | 83.3% |
|
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.IRender;
|
|
18 |
|
|
19 |
/**
|
|
20 |
* Thrown by a {@link IValidator} when submitted input is not valid.
|
|
21 |
*
|
|
22 |
* @author Howard Lewis Ship
|
|
23 |
* @since 1.0.8
|
|
24 |
*
|
|
25 |
**/
|
|
26 |
|
|
27 |
public class ValidatorException extends Exception |
|
28 |
{ |
|
29 |
private IRender _errorRenderer;
|
|
30 |
private ValidationConstraint _constraint;
|
|
31 |
|
|
32 | 0 |
public ValidatorException(String errorMessage)
|
33 |
{ |
|
34 | 0 |
this(errorMessage, null, null); |
35 |
} |
|
36 |
|
|
37 | 37 |
public ValidatorException(String errorMessage, ValidationConstraint constraint)
|
38 |
{ |
|
39 | 37 |
this(errorMessage, null, constraint); |
40 |
} |
|
41 |
|
|
42 |
/**
|
|
43 |
* Creates a new instance.
|
|
44 |
* @param errorMessage the default error message to be used (this may be
|
|
45 |
* overriden by the {@link IValidationDelegate})
|
|
46 |
* @param errorRenderer to use to render the error message (may be null)
|
|
47 |
* @param constraint a validation constraint that has been compromised, or
|
|
48 |
* null if no constraint is applicable
|
|
49 |
*
|
|
50 |
**/
|
|
51 |
|
|
52 | 38 |
public ValidatorException(
|
53 |
String errorMessage, |
|
54 |
IRender errorRenderer, |
|
55 |
ValidationConstraint constraint) |
|
56 |
{ |
|
57 | 38 |
super(errorMessage);
|
58 |
|
|
59 | 38 |
_errorRenderer = errorRenderer; |
60 | 38 |
_constraint = constraint; |
61 |
} |
|
62 |
|
|
63 | 29 |
public ValidationConstraint getConstraint()
|
64 |
{ |
|
65 | 29 |
return _constraint;
|
66 |
} |
|
67 |
|
|
68 |
/** @since 3.0 **/
|
|
69 |
|
|
70 | 9 |
public IRender getErrorRenderer()
|
71 |
{ |
|
72 | 9 |
return _errorRenderer;
|
73 |
} |
|
74 |
} |
|