KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > tools > common > validation > constraints > ConstraintFailure


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * ConstraintFailure.java May 7, 2003, 11:11 AM
26  *
27  */

28
29 package com.sun.enterprise.tools.common.validation.constraints;
30
31 import com.sun.enterprise.tools.common.validation.Failure;
32
33 /**
34  * ConstraintFailure is a Validation failure Object.
35  * It provides the following failure information; Constraint failed,
36  * the value it failed for; the name of the value it failed for,
37  * failure message and the generic failure message.
38  *
39  * @author Rajeshwar Patil
40  * @version %I%, %G%
41  */

42 public class ConstraintFailure implements Failure{
43
44     /**
45      * The name of the failed <code>Constraint</code>.
46      */

47     private String JavaDoc constraint = null;
48
49     /**
50      * The name of the value, the <code>Constraint</code> failed for.
51      */

52     private String JavaDoc name = null;
53
54     /**
55      * The value, the <code>Constraint</code> failed for.
56      */

57     private Object JavaDoc value = null;
58
59     /**
60      * The failure message.
61      */

62     private String JavaDoc failureMessage = null;
63
64
65     /**
66      * The generic failure message.
67      */

68     private String JavaDoc genericFailureMessage = null;
69
70
71     /** Creates a new instance of ConstraintFailure */
72     public ConstraintFailure(String JavaDoc constraint,
73         Object JavaDoc value, String JavaDoc name, String JavaDoc failureMessage,
74                 String JavaDoc genericFailureMessage) {
75             this.constraint = constraint;
76             this.value = value;
77             this.failureMessage = failureMessage;
78             this.name = name;
79             this.genericFailureMessage = genericFailureMessage;
80     }
81
82
83     /**
84      * Returns the failed <code>Constraint</code> this Object represents.
85      */

86     public String JavaDoc getConstraint(){
87         return constraint;
88     }
89
90
91     /**
92      * Returns the value failed for the <code>Constraint</code>
93      * represented by this Object.
94      */

95     public Object JavaDoc getFailedValue(){
96         return value;
97     }
98
99
100     /**
101      * Returns an failure message for this failure.
102      */

103     public String JavaDoc failureMessage(){
104         return failureMessage;
105     }
106
107
108     /**
109      * Returns the name of the value failed for the
110      * <code>Constraint</code> represented by this Object.
111      */

112     public String JavaDoc getName(){
113         return name;
114     }
115
116
117     /**
118      * Returns generic message for this failure.
119      */

120     public String JavaDoc getGenericfailureMessage(){
121         return genericFailureMessage;
122     }
123 }
124
Popular Tags