KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > xerces > impl > dv > ValidatedInfo


1 /*
2  * Copyright 2001, 2002,2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.xerces.impl.dv;
18
19 import org.apache.xerces.xs.ShortList;
20
21 /**
22  * Class to get the information back after content is validated. This info
23  * would be filled by validate().
24  *
25  * @xerces.internal
26  *
27  * @author Neeraj Bajaj, Sun Microsystems, inc.
28  *
29  * @version $Id: ValidatedInfo.java,v 1.8 2004/10/06 14:56:50 mrglavas Exp $
30  */

31 public class ValidatedInfo {
32
33     /**
34      * The normalized value of a string value
35      */

36     public String JavaDoc normalizedValue;
37
38     /**
39      * The actual value from a string value (QName, Boolean, etc.)
40      * An array of Objects if the type is a list.
41      */

42     public Object JavaDoc actualValue;
43
44     /**
45      * The type of the actual value. It's one of the _DT constants
46      * defined in XSConstants.java. The value is used to indicate
47      * the most specific built-in type.
48      * (i.e. short instead of decimal or integer).
49      */

50     public short actualValueType;
51
52     /**
53      * If the type is a union type, then the member type which
54      * actually validated the string value.
55      */

56     public XSSimpleType memberType;
57
58     /**
59      * If
60      * 1. the type is a union type where one of the member types is a list, or
61      * if the type is a list; and
62      * 2. the item type of the list is a union type
63      * then an array of member types used to validate the values.
64      */

65     public XSSimpleType[] memberTypes;
66
67     /**
68      * In the case the value is a list or a list of unions, this value
69      * indicates the type(s) of the items in the list.
70      * For a normal list, the length of the array is 1; for list of unions,
71      * the length of the array is the same as the length of the list.
72      */

73     public ShortList itemValueTypes;
74
75     /**
76      * reset the state of this object
77      */

78     public void reset() {
79         this.normalizedValue = null;
80         this.actualValue = null;
81         this.memberType = null;
82         this.memberTypes = null;
83     }
84     
85     /**
86      * Return a string representation of the value. If there is an actual
87      * value, use toString; otherwise, use the normalized value.
88      */

89     public String JavaDoc stringValue() {
90         if (actualValue == null)
91             return normalizedValue;
92         else
93             return actualValue.toString();
94     }
95 }
96
Popular Tags