KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > j2ee > sun > validation > constraints > ConstraintFailure


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.j2ee.sun.validation.constraints;
21
22 import org.netbeans.modules.j2ee.sun.validation.Failure;
23
24 /**
25  * ConstraintFailure is a Validation failure Object.
26  * It provides the following failure information; Constraint failed,
27  * the value it failed for; the name of the value it failed for,
28  * failure message and the generic failure message.
29  *
30  * @author Rajeshwar Patil
31  * @version %I%, %G%
32  */

33 public class ConstraintFailure implements Failure{
34
35     /**
36      * The name of the failed <code>Constraint</code>.
37      */

38     private String JavaDoc constraint = null;
39
40     /**
41      * The name of the value, the <code>Constraint</code> failed for.
42      */

43     private String JavaDoc name = null;
44
45     /**
46      * The value, the <code>Constraint</code> failed for.
47      */

48     private Object JavaDoc value = null;
49
50     /**
51      * The failure message.
52      */

53     private String JavaDoc failureMessage = null;
54
55
56     /**
57      * The generic failure message.
58      */

59     private String JavaDoc genericFailureMessage = null;
60
61
62     /** Creates a new instance of ConstraintFailure */
63     public ConstraintFailure(String JavaDoc constraint,
64         Object JavaDoc value, String JavaDoc name, String JavaDoc failureMessage,
65                 String JavaDoc genericFailureMessage) {
66             this.constraint = constraint;
67             this.value = value;
68             this.failureMessage = failureMessage;
69             this.name = name;
70             this.genericFailureMessage = genericFailureMessage;
71     }
72
73
74     /**
75      * Returns the failed <code>Constraint</code> this Object represents.
76      */

77     public String JavaDoc getConstraint(){
78         return constraint;
79     }
80
81
82     /**
83      * Returns the value failed for the <code>Constraint</code>
84      * represented by this Object.
85      */

86     public Object JavaDoc getFailedValue(){
87         return value;
88     }
89
90
91     /**
92      * Returns an failure message for this failure.
93      */

94     public String JavaDoc failureMessage(){
95         return failureMessage;
96     }
97
98
99     /**
100      * Returns the name of the value failed for the
101      * <code>Constraint</code> represented by this Object.
102      */

103     public String JavaDoc getName(){
104         return name;
105     }
106
107
108     /**
109      * Returns generic message for this failure.
110      */

111     public String JavaDoc getGenericfailureMessage(){
112         return genericFailureMessage;
113     }
114 }
115
Popular Tags