View Javadoc
1   /*
2    * reserved comment block
3    * DO NOT REMOVE OR ALTER!
4    */
5   /*
6    * Copyright 2001, 2002,2004 The Apache Software Foundation.
7    *
8    * Licensed under the Apache License, Version 2.0 (the "License");
9    * you may not use this file except in compliance with the License.
10   * You may obtain a copy of the License at
11   *
12   *      http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS,
16   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17   * See the License for the specific language governing permissions and
18   * limitations under the License.
19   */
20  
21  package com.sun.org.apache.xerces.internal.impl.dv;
22  
23  import com.sun.org.apache.xerces.internal.xs.ShortList;
24  
25  /**
26   * Class to get the information back after content is validated. This info
27   * would be filled by validate().
28   *
29   * @xerces.internal
30   *
31   * @author Neeraj Bajaj, Sun Microsystems, inc.
32   *
33   */
34  public class ValidatedInfo {
35  
36      /**
37       * The normalized value of a string value
38       */
39      public String normalizedValue;
40  
41      /**
42       * The actual value from a string value (QName, Boolean, etc.)
43       * An array of Objects if the type is a list.
44       */
45      public Object actualValue;
46  
47      /**
48       * The type of the actual value. It's one of the _DT constants
49       * defined in XSConstants.java. The value is used to indicate
50       * the most specific built-in type.
51       * (i.e. short instead of decimal or integer).
52       */
53      public short actualValueType;
54  
55      /**
56       * If the type is a union type, then the member type which
57       * actually validated the string value.
58       */
59      public XSSimpleType memberType;
60  
61      /**
62       * If
63       * 1. the type is a union type where one of the member types is a list, or
64       *    if the type is a list; and
65       * 2. the item type of the list is a union type
66       * then an array of member types used to validate the values.
67       */
68      public XSSimpleType[] memberTypes;
69  
70      /**
71       * In the case the value is a list or a list of unions, this value
72       * indicates the type(s) of the items in the list.
73       * For a normal list, the length of the array is 1; for list of unions,
74       * the length of the array is the same as the length of the list.
75       */
76      public ShortList itemValueTypes;
77  
78      /**
79       * reset the state of this object
80       */
81      public void reset() {
82          this.normalizedValue = null;
83          this.actualValue = null;
84          this.memberType = null;
85          this.memberTypes = null;
86      }
87  
88      /**
89       * Return a string representation of the value. If there is an actual
90       * value, use toString; otherwise, use the normalized value.
91       */
92      public String stringValue() {
93          if (actualValue == null)
94              return normalizedValue;
95          else
96              return actualValue.toString();
97      }
98  }