KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > datatype > xsd > ValueRestrictDatatype


1 package com.thaiopensource.datatype.xsd;
2
3 import org.relaxng.datatype.ValidationContext;
4
5 abstract class ValueRestrictDatatype extends RestrictDatatype {
6   ValueRestrictDatatype(DatatypeBase base) {
7     super(base);
8   }
9
10   boolean allowsValue(String JavaDoc str, ValidationContext vc) {
11     return getValue(str, vc) != null;
12   }
13
14   Object JavaDoc getValue(String JavaDoc str, ValidationContext vc) {
15     Object JavaDoc obj = base.getValue(str, vc);
16     if (obj == null || !satisfiesRestriction(obj))
17       return null;
18     return obj;
19   }
20
21   abstract boolean satisfiesRestriction(Object JavaDoc value);
22 }
23
Popular Tags