001: /*
002: * The Apache Software License, Version 1.1
003: *
004: *
005: * Copyright (c) 1999, 2000, 2001 The Apache Software Foundation. All rights
006: * reserved.
007: *
008: * Redistribution and use in source and binary forms, with or without
009: * modification, are permitted provided that the following conditions
010: * are met:
011: *
012: * 1. Redistributions of source code must retain the above copyright
013: * notice, this list of conditions and the following disclaimer.
014: *
015: * 2. Redistributions in binary form must reproduce the above copyright
016: * notice, this list of conditions and the following disclaimer in
017: * the documentation and/or other materials provided with the
018: * distribution.
019: *
020: * 3. The end-user documentation included with the redistribution,
021: * if any, must include the following acknowledgment:
022: * "This product includes software developed by the
023: * Apache Software Foundation (http://www.apache.org/)."
024: * Alternately, this acknowledgment may appear in the software itself,
025: * if and wherever such third-party acknowledgments normally appear.
026: *
027: * 4. The names "Xerces" and "Apache Software Foundation" must
028: * not be used to endorse or promote products derived from this
029: * software without prior written permission. For written
030: * permission, please contact apache@apache.org.
031: *
032: * 5. Products derived from this software may not be called "Apache",
033: * nor may "Apache" appear in their name, without prior written
034: * permission of the Apache Software Foundation.
035: *
036: * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
037: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
038: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
039: * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
040: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
041: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
042: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
043: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
044: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
045: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
046: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
047: * SUCH DAMAGE.
048: * ====================================================================
049: *
050: * This software consists of voluntary contributions made by many
051: * individuals on behalf of the Apache Software Foundation and was
052: * originally based on software copyright (c) 2001, International
053: * Business Machines, Inc., http://www.apache.org. For more
054: * information on the Apache Software Foundation, please see
055: * <http://www.apache.org/>.
056: */
057:
058: package org.apache.xerces.validators.datatype;
059:
060: import java.util.Enumeration;
061: import java.util.Hashtable;
062: import java.util.Vector;
063: import java.io.IOException;
064: import org.apache.xerces.validators.schema.SchemaSymbols;
065: import org.apache.xerces.utils.regex.RegularExpression;
066:
067: /**
068: * AbstractNumericFacetValidator is a base class for decimal, double, float,
069: * and all date/time datatype validators. It implements evaluation of common facets -
070: * minInclusive, maxInclusive, minExclusive, maxExclusive according to schema specs.
071: *
072: * @author Elena Litani
073: * @version $Id: AbstractNumericFacetValidator.java,v 1.5 2001/05/30 21:25:47 elena Exp $
074: */
075:
076: public abstract class AbstractNumericFacetValidator extends
077: AbstractDatatypeValidator {
078:
079: protected Object[] fEnumeration = null;
080: protected Object fMaxInclusive = null;
081: protected Object fMaxExclusive = null;
082: protected Object fMinInclusive = null;
083: protected Object fMinExclusive = null;
084:
085: protected static final short INDETERMINATE = 2;
086:
087: public AbstractNumericFacetValidator()
088: throws InvalidDatatypeFacetException {
089: this (null, null, false); // Native, No Facets defined, Restriction
090: }
091:
092: public AbstractNumericFacetValidator(DatatypeValidator base,
093: Hashtable facets, boolean derivedByList)
094: throws InvalidDatatypeFacetException {
095: fBaseValidator = base;
096:
097: // list types are handled by ListDatatypeValidator, we do nothing here.
098: if (derivedByList)
099: return;
100: initializeValues();
101: // Set Facets if any defined
102: if (facets != null) {
103: int result; // result of comparison
104: Vector enumeration = null;
105: for (Enumeration e = facets.keys(); e.hasMoreElements();) {
106: String key = (String) e.nextElement();
107: String value = null;
108: try {
109: if (key.equals(SchemaSymbols.ELT_PATTERN)) {
110: fFacetsDefined |= DatatypeValidator.FACET_PATTERN;
111: fPattern = (String) facets.get(key);
112: if (fPattern != null)
113: fRegex = new RegularExpression(fPattern,
114: "X");
115: } else if (key
116: .equals(SchemaSymbols.ELT_ENUMERATION)) {
117: enumeration = (Vector) facets.get(key);
118: fFacetsDefined |= DatatypeValidator.FACET_ENUMERATION;
119: } else if (key
120: .equals(SchemaSymbols.ELT_MAXINCLUSIVE)) {
121: value = ((String) facets.get(key));
122: fFacetsDefined |= DatatypeValidator.FACET_MAXINCLUSIVE;
123: setMaxInclusive(value);
124: } else if (key
125: .equals(SchemaSymbols.ELT_MAXEXCLUSIVE)) {
126: value = ((String) facets.get(key));
127: fFacetsDefined |= DatatypeValidator.FACET_MAXEXCLUSIVE;
128: setMaxExclusive(value);
129: } else if (key
130: .equals(SchemaSymbols.ELT_MININCLUSIVE)) {
131: value = ((String) facets.get(key));
132: fFacetsDefined |= DatatypeValidator.FACET_MININCLUSIVE;
133: setMinInclusive(value);
134: } else if (key
135: .equals(SchemaSymbols.ELT_MINEXCLUSIVE)) {
136: value = ((String) facets.get(key));
137: fFacetsDefined |= DatatypeValidator.FACET_MINEXCLUSIVE;
138: setMinExclusive(value);
139: } else if (key
140: .equals(DatatypeValidator.FACET_FIXED)) {// fixed flags
141: fFlags = ((Short) facets.get(key)).shortValue();
142: } else {
143: assignAdditionalFacets(key, facets);
144: }
145: } catch (Exception ex) {
146: if (value == null) {
147: //invalid facet error
148: throw new InvalidDatatypeFacetException(ex
149: .getMessage());
150: } else {
151: throw new InvalidDatatypeFacetException(
152: (getErrorString(
153: DatatypeMessageProvider.ILLEGAL_FACET_VALUE,
154: DatatypeMessageProvider.MSG_NONE,
155: new Object[] { value, key })));
156: }
157: }
158: }
159:
160: if (fFacetsDefined != 0) {
161: // check 4.3.8.c1 error: maxInclusive + maxExclusive
162: if (((fFacetsDefined & DatatypeValidator.FACET_MAXEXCLUSIVE) != 0)
163: && ((fFacetsDefined & DatatypeValidator.FACET_MAXINCLUSIVE) != 0)) {
164: throw new InvalidDatatypeFacetException(
165: "It is an error for both maxInclusive and maxExclusive to be specified for the same datatype.");
166: }
167: // check 4.3.9.c1 error: minInclusive + minExclusive
168: if (((fFacetsDefined & DatatypeValidator.FACET_MINEXCLUSIVE) != 0)
169: && ((fFacetsDefined & DatatypeValidator.FACET_MININCLUSIVE) != 0)) {
170: throw new InvalidDatatypeFacetException(
171: "It is an error for both minInclusive and minExclusive to be specified for the same datatype.");
172: }
173:
174: // check 4.3.7.c1 must: minInclusive <= maxInclusive
175: if (((fFacetsDefined & DatatypeValidator.FACET_MAXINCLUSIVE) != 0)
176: && ((fFacetsDefined & DatatypeValidator.FACET_MININCLUSIVE) != 0)) {
177: result = compareValues(fMinInclusive, fMaxInclusive);
178: if (result == 1 || result == INDETERMINATE)
179: throw new InvalidDatatypeFacetException(
180: "minInclusive value ='"
181: + getMinInclusive(false)
182: + "'must be <= maxInclusive value ='"
183: + getMaxInclusive(false)
184: + "'. ");
185: }
186: // check 4.3.8.c2 must: minExclusive <= maxExclusive ??? minExclusive < maxExclusive
187: if (((fFacetsDefined & DatatypeValidator.FACET_MAXEXCLUSIVE) != 0)
188: && ((fFacetsDefined & DatatypeValidator.FACET_MINEXCLUSIVE) != 0)) {
189: result = compareValues(fMinExclusive, fMaxExclusive);
190: if (result == 1 || result == INDETERMINATE)
191: throw new InvalidDatatypeFacetException(
192: "minExclusive value ='"
193: + getMinExclusive(false)
194: + "'must be <= maxExclusive value ='"
195: + getMaxExclusive(false)
196: + "'. ");
197: }
198: // check 4.3.9.c2 must: minExclusive < maxInclusive
199: if (((fFacetsDefined & DatatypeValidator.FACET_MAXINCLUSIVE) != 0)
200: && ((fFacetsDefined & DatatypeValidator.FACET_MINEXCLUSIVE) != 0)) {
201: if (compareValues(fMinExclusive, fMaxInclusive) != -1)
202: throw new InvalidDatatypeFacetException(
203: "minExclusive value ='"
204: + getMinExclusive(false)
205: + "'must be > maxInclusive value ='"
206: + getMaxInclusive(false)
207: + "'. ");
208: }
209: // check 4.3.10.c1 must: minInclusive < maxExclusive
210: if (((fFacetsDefined & DatatypeValidator.FACET_MAXEXCLUSIVE) != 0)
211: && ((fFacetsDefined & DatatypeValidator.FACET_MININCLUSIVE) != 0)) {
212: if (compareValues(fMinInclusive, fMaxExclusive) != -1)
213: throw new InvalidDatatypeFacetException(
214: "minInclusive value ='"
215: + getMinInclusive(false)
216: + "'must be < maxExclusive value ='"
217: + getMaxExclusive(false)
218: + "'. ");
219: }
220: checkFacetConstraints();
221:
222: }
223:
224: if (base != null) {
225: AbstractNumericFacetValidator numBase = (AbstractNumericFacetValidator) base;
226: if (fFacetsDefined != 0) {
227:
228: // check 4.3.7.c2 error:
229: // maxInclusive > base.maxInclusive
230: // maxInclusive >= base.maxExclusive
231: // maxInclusive < base.minInclusive
232: // maxInclusive <= base.minExclusive
233:
234: if (((fFacetsDefined & DatatypeValidator.FACET_MAXINCLUSIVE) != 0)) {
235: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MAXINCLUSIVE) != 0)) {
236: result = compareValues(fMaxInclusive,
237: numBase.fMaxInclusive);
238: if ((numBase.fFlags & DatatypeValidator.FACET_MAXINCLUSIVE) != 0
239: && result != 0) {
240: throw new InvalidDatatypeFacetException(
241: "maxInclusive value = '"
242: + getMaxInclusive(false)
243: + "' must be equal to base.maxInclusive value = '"
244: + getMaxInclusive(true)
245: + "' with attribute {fixed} = true");
246: }
247: if (result == 1 || result == INDETERMINATE) {
248: throw new InvalidDatatypeFacetException(
249: "maxInclusive value ='"
250: + getMaxInclusive(false)
251: + "' must be <= base.maxInclusive value ='"
252: + getMaxInclusive(true)
253: + "'.");
254: }
255: }
256: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MAXEXCLUSIVE) != 0)
257: && compareValues(fMaxInclusive,
258: numBase.fMaxExclusive) != -1)
259: throw new InvalidDatatypeFacetException(
260: "maxInclusive value ='"
261: + getMaxInclusive(false)
262: + "' must be < base.maxExclusive value ='"
263: + getMaxExclusive(true)
264: + "'.");
265: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MININCLUSIVE) != 0)) {
266: result = compareValues(fMaxInclusive,
267: numBase.fMinInclusive);
268: if (result == -1 || result == INDETERMINATE) {
269: throw new InvalidDatatypeFacetException(
270: "maxInclusive value ='"
271: + getMaxInclusive(false)
272: + "' must be >= base.minInclusive value ='"
273: + getMinInclusive(true)
274: + "'.");
275: }
276: }
277: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MINEXCLUSIVE) != 0)
278: && compareValues(fMaxInclusive,
279: numBase.fMinExclusive) != 1)
280: throw new InvalidDatatypeFacetException(
281: "maxInclusive value ='"
282: + getMaxInclusive(false)
283: + "' must be > base.minExclusive value ='"
284: + getMinExclusive(true)
285: + "'.");
286: }
287:
288: // check 4.3.8.c3 error:
289: // maxExclusive > base.maxExclusive
290: // maxExclusive > base.maxInclusive
291: // maxExclusive <= base.minInclusive
292: // maxExclusive <= base.minExclusive
293: if (((fFacetsDefined & DatatypeValidator.FACET_MAXEXCLUSIVE) != 0)) {
294: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MAXEXCLUSIVE) != 0)) {
295: result = compareValues(fMaxExclusive,
296: numBase.fMaxExclusive);
297: if ((numBase.fFlags & DatatypeValidator.FACET_MAXEXCLUSIVE) != 0
298: && result != 0) {
299: throw new InvalidDatatypeFacetException(
300: "maxExclusive value = '"
301: + getMaxExclusive(false)
302: + "' must be equal to base.maxExclusive value = '"
303: + getMaxExclusive(true)
304: + "' with attribute {fixed} = true");
305: }
306: if (result == 1 || result == INDETERMINATE) {
307: throw new InvalidDatatypeFacetException(
308: "maxExclusive value ='"
309: + getMaxExclusive(false)
310: + "' must be < base.maxExclusive value ='"
311: + getMaxExclusive(true)
312: + "'.");
313: }
314: }
315: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MAXINCLUSIVE) != 0)) {
316: result = compareValues(fMaxExclusive,
317: numBase.fMaxInclusive);
318: if (result == 1 || result == INDETERMINATE) {
319: throw new InvalidDatatypeFacetException(
320: "maxExclusive value ='"
321: + getMaxExclusive(false)
322: + "' must be <= base.maxInclusive value ='"
323: + getMaxInclusive(true)
324: + "'.");
325: }
326: }
327: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MINEXCLUSIVE) != 0)
328: && compareValues(fMaxExclusive,
329: numBase.fMinExclusive) != 1)
330: throw new InvalidDatatypeFacetException(
331: "maxExclusive value ='"
332: + getMaxExclusive(false)
333: + "' must be > base.minExclusive value ='"
334: + getMinExclusive(true)
335: + "'.");
336: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MININCLUSIVE) != 0)
337: && compareValues(fMaxExclusive,
338: numBase.fMinInclusive) != 1)
339: throw new InvalidDatatypeFacetException(
340: "maxExclusive value ='"
341: + getMaxExclusive(false)
342: + "' must be > base.minInclusive value ='"
343: + getMinInclusive(true)
344: + "'.");
345: }
346:
347: // check 4.3.9.c3 error:
348: // minExclusive < base.minExclusive
349: // minExclusive > base.maxInclusive ??? minExclusive >= base.maxInclusive
350: // minExclusive < base.minInclusive
351: // minExclusive >= base.maxExclusive
352: if (((fFacetsDefined & DatatypeValidator.FACET_MINEXCLUSIVE) != 0)) {
353: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MINEXCLUSIVE) != 0)) {
354: result = compareValues(fMinExclusive,
355: numBase.fMinExclusive);
356: if ((numBase.fFlags & DatatypeValidator.FACET_MINEXCLUSIVE) != 0
357: && result != 0) {
358: throw new InvalidDatatypeFacetException(
359: "minExclusive value = '"
360: + getMinExclusive(false)
361: + "' must be equal to base.minExclusive value = '"
362: + getMinExclusive(true)
363: + "' with attribute {fixed} = true");
364: }
365: if (result == -1 || result == INDETERMINATE) {
366: throw new InvalidDatatypeFacetException(
367: "minExclusive value ='"
368: + getMinExclusive(false)
369: + "' must be >= base.minExclusive value ='"
370: + getMinExclusive(true)
371: + "'.");
372: }
373: }
374: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MAXINCLUSIVE) != 0)) {
375: result = compareValues(fMinExclusive,
376: numBase.fMaxInclusive);
377: if (result == 1 || result == INDETERMINATE) {
378: throw new InvalidDatatypeFacetException(
379: "minExclusive value ='"
380: + getMinExclusive(false)
381: + "' must be <= base.maxInclusive value ='"
382: + getMaxInclusive(true)
383: + "'.");
384: }
385: }
386: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MININCLUSIVE) != 0)) {
387: result = compareValues(fMinExclusive,
388: numBase.fMinInclusive);
389: if (result == -1 || result == INDETERMINATE) {
390: throw new InvalidDatatypeFacetException(
391: "minExclusive value ='"
392: + getMinExclusive(false)
393: + "' must be >= base.minInclusive value ='"
394: + getMinInclusive(true)
395: + "'.");
396: }
397: }
398: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MAXEXCLUSIVE) != 0)
399: && compareValues(fMinExclusive,
400: numBase.fMaxExclusive) != -1)
401: throw new InvalidDatatypeFacetException(
402: "minExclusive value ='"
403: + getMinExclusive(false)
404: + "' must be < base.maxExclusive value ='"
405: + getMaxExclusive(true)
406: + "'.");
407: }
408:
409: // check 4.3.10.c2 error:
410: // minInclusive < base.minInclusive
411: // minInclusive > base.maxInclusive
412: // minInclusive <= base.minExclusive
413: // minInclusive >= base.maxExclusive
414: if (((fFacetsDefined & DatatypeValidator.FACET_MININCLUSIVE) != 0)) {
415: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MININCLUSIVE) != 0)) {
416: result = compareValues(fMinInclusive,
417: numBase.fMinInclusive);
418: if ((numBase.fFlags & DatatypeValidator.FACET_MININCLUSIVE) != 0
419: && result != 0) {
420: throw new InvalidDatatypeFacetException(
421: "minInclusive value = '"
422: + getMinInclusive(false)
423: + "' must be equal to base.minInclusive value = '"
424: + getMinInclusive(true)
425: + "' with attribute {fixed} = true");
426: }
427: if (result == -1 || result == INDETERMINATE) {
428: throw new InvalidDatatypeFacetException(
429: "minInclusive value ='"
430: + getMinInclusive(false)
431: + "' must be >= base.minInclusive value ='"
432: + getMinInclusive(true)
433: + "'.");
434: }
435: }
436: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MAXINCLUSIVE) != 0)) {
437: result = compareValues(fMinInclusive,
438: numBase.fMaxInclusive);
439: if (result == 1 || result == INDETERMINATE) {
440: throw new InvalidDatatypeFacetException(
441: "minInclusive value ='"
442: + getMinInclusive(false)
443: + "' must be <= base.maxInclusive value ='"
444: + getMaxInclusive(true)
445: + "'.");
446: }
447: }
448: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MINEXCLUSIVE) != 0)
449: && compareValues(fMinInclusive,
450: numBase.fMinExclusive) != 1)
451: throw new InvalidDatatypeFacetException(
452: "minInclusive value ='"
453: + getMinInclusive(false)
454: + "' must be > base.minExclusive value ='"
455: + getMinExclusive(true)
456: + "'.");
457: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MAXEXCLUSIVE) != 0)
458: && compareValues(fMinInclusive,
459: numBase.fMaxExclusive) != -1)
460: throw new InvalidDatatypeFacetException(
461: "minInclusive value ='"
462: + getMinInclusive(false)
463: + "' must be < base.maxExclusive value ='"
464: + getMaxExclusive(true)
465: + "'.");
466: }
467: checkBaseFacetConstraints();
468:
469: }
470: // check question error: fractionDigits > base.fractionDigits ???
471: // check question error: fractionDigits > base.totalDigits ???
472: // check question error: totalDigits conflicts with bounds ???
473:
474: // inherit enumeration
475: if ((fFacetsDefined & DatatypeValidator.FACET_ENUMERATION) == 0
476: && (numBase.fFacetsDefined & DatatypeValidator.FACET_ENUMERATION) != 0) {
477: fFacetsDefined |= DatatypeValidator.FACET_ENUMERATION;
478: fEnumeration = numBase.fEnumeration;
479: }
480: // inherit maxExclusive
481: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MAXEXCLUSIVE) != 0)
482: && !((fFacetsDefined & DatatypeValidator.FACET_MAXEXCLUSIVE) != 0)
483: && !((fFacetsDefined & DatatypeValidator.FACET_MAXINCLUSIVE) != 0)) {
484: fFacetsDefined |= FACET_MAXEXCLUSIVE;
485: fMaxExclusive = numBase.fMaxExclusive;
486: }
487: // inherit maxInclusive
488: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MAXINCLUSIVE) != 0)
489: && !((fFacetsDefined & DatatypeValidator.FACET_MAXEXCLUSIVE) != 0)
490: && !((fFacetsDefined & DatatypeValidator.FACET_MAXINCLUSIVE) != 0)) {
491: fFacetsDefined |= FACET_MAXINCLUSIVE;
492: fMaxInclusive = numBase.fMaxInclusive;
493: }
494: // inherit minExclusive
495: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MINEXCLUSIVE) != 0)
496: && !((fFacetsDefined & DatatypeValidator.FACET_MINEXCLUSIVE) != 0)
497: && !((fFacetsDefined & DatatypeValidator.FACET_MININCLUSIVE) != 0)) {
498: fFacetsDefined |= FACET_MINEXCLUSIVE;
499: fMinExclusive = numBase.fMinExclusive;
500: }
501: // inherit minExclusive
502: if (((numBase.fFacetsDefined & DatatypeValidator.FACET_MININCLUSIVE) != 0)
503: && !((fFacetsDefined & DatatypeValidator.FACET_MINEXCLUSIVE) != 0)
504: && !((fFacetsDefined & DatatypeValidator.FACET_MININCLUSIVE) != 0)) {
505: fFacetsDefined |= FACET_MININCLUSIVE;
506: fMinInclusive = numBase.fMinInclusive;
507: }
508:
509: inheritAdditionalFacets();
510:
511: //inherit fixed values
512: fFlags |= numBase.fFlags;
513:
514: // check 4.3.5.c0 must: enumeration values from the value space of base
515: if ((fFacetsDefined & DatatypeValidator.FACET_ENUMERATION) != 0) {
516: if (enumeration != null) {
517: try {
518: setEnumeration(enumeration);
519: } catch (Exception idve) {
520: throw new InvalidDatatypeFacetException(
521: idve.getMessage());
522: }
523: }
524:
525: }
526: }
527: }//End of Facet setup
528: }
529:
530: //
531: // Compares values in value space of give datatype
532: //
533: abstract protected int compareValues(Object value1, Object value2);
534:
535: //
536: // set* functions used to set facets values
537: //
538: abstract protected void setMaxInclusive(String value);
539:
540: abstract protected void setMinInclusive(String value);
541:
542: abstract protected void setMaxExclusive(String value);
543:
544: abstract protected void setMinExclusive(String value);
545:
546: abstract protected void setEnumeration(Vector enumeration)
547: throws InvalidDatatypeValueException;
548:
549: //
550: // get* functions used to output error messages
551: //
552: abstract protected String getMaxInclusive(boolean isBase);
553:
554: abstract protected String getMinInclusive(boolean isBase);
555:
556: abstract protected String getMaxExclusive(boolean isBase);
557:
558: abstract protected String getMinExclusive(boolean isBase);
559:
560: //
561: // date/times need to initialize structure objects
562: //
563: protected void initializeValues() {
564: }
565:
566: //
567: // decimal has fractionDigits and totalDigits facets
568: // all other datatypes will throw InvalidDatatypeFacetException
569: //
570: abstract protected void assignAdditionalFacets(String key,
571: Hashtable facets) throws InvalidDatatypeFacetException;
572:
573: //
574: // decimal needs to inherit totalDigits and fractionDigits
575: //
576: protected void inheritAdditionalFacets() {
577: }
578:
579: //
580: // decimal needs to check constraints on totalDigits and fractionDigits
581: // check is done against fBaseValidator
582: //
583: protected void checkBaseFacetConstraints()
584: throws InvalidDatatypeFacetException {
585: }
586:
587: //
588: // decimal needs to check constraints on totalDigits and fractionDigits
589: //
590: protected void checkFacetConstraints()
591: throws InvalidDatatypeFacetException {
592: }
593:
594: }
|