KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > relaxng > impl > StringDatatype


1 package com.thaiopensource.relaxng.impl;
2
3 import com.thaiopensource.datatype.Datatype2;
4 import org.relaxng.datatype.DatatypeException;
5 import org.relaxng.datatype.DatatypeStreamingValidator;
6 import org.relaxng.datatype.ValidationContext;
7 import org.relaxng.datatype.helpers.StreamingValidatorImpl;
8
9 class StringDatatype implements Datatype2 {
10   public boolean isValid(String JavaDoc str, ValidationContext vc) {
11     return true;
12   }
13
14   public void checkValid(String JavaDoc str, ValidationContext vc) throws DatatypeException {
15     if (!isValid(str, vc))
16       throw new DatatypeException();
17   }
18
19   public Object JavaDoc createValue(String JavaDoc str, ValidationContext vc) {
20     return str;
21   }
22
23   public boolean isContextDependent() {
24     return false;
25   }
26
27   public boolean alwaysValid() {
28     return true;
29   }
30
31   public int getIdType() {
32     return ID_TYPE_NULL;
33   }
34
35   public boolean sameValue(Object JavaDoc obj1, Object JavaDoc obj2) {
36     return obj1.equals(obj2);
37   }
38
39   public int valueHashCode(Object JavaDoc obj) {
40     return obj.hashCode();
41   }
42
43   public DatatypeStreamingValidator createStreamingValidator(ValidationContext vc) {
44     return new StreamingValidatorImpl(this, vc);
45   }
46 }
47
Popular Tags