com.thaiopensource.datatype.xsd
Class RestrictDatatype

java.lang.Object
  extended by com.thaiopensource.datatype.xsd.DatatypeBase
      extended by com.thaiopensource.datatype.xsd.RestrictDatatype
All Implemented Interfaces:
Datatype2, Datatype
Direct Known Subclasses:
PatternRestrictDatatype, ValueRestrictDatatype

 class RestrictDatatype
extends DatatypeBase


Field Summary
protected  DatatypeBase base
           
 
Fields inherited from class com.thaiopensource.datatype.xsd.DatatypeBase
WHITE_SPACE_COLLAPSE, WHITE_SPACE_PRESERVE, WHITE_SPACE_REPLACE
 
Fields inherited from interface org.relaxng.datatype.Datatype
ID_TYPE_ID, ID_TYPE_IDREF, ID_TYPE_IDREFS, ID_TYPE_NULL
 
Constructor Summary
RestrictDatatype(DatatypeBase base)
           
RestrictDatatype(DatatypeBase base, int whiteSpace)
           
 
Method Summary
(package private)  boolean allowsValue(String str, ValidationContext vc)
           
 int getIdType()
          Checks if the ID/IDREF semantics is associated with this datatype.
(package private)  Measure getMeasure()
           
(package private)  OrderRelation getOrderRelation()
           
(package private)  DatatypeBase getPrimitive()
           
(package private)  Object getValue(String str, ValidationContext vc)
           
(package private)  boolean lexicallyAllows(String str)
           
 boolean sameValue(Object value1, Object value2)
          Tests the equality of two value objects which were originally created by the createValue method of this object.
 int valueHashCode(Object value)
          Computes the hash code for a value object, which is consistent with the sameValue method.
 
Methods inherited from class com.thaiopensource.datatype.xsd.DatatypeBase
alwaysValid, checkValid, createStreamingValidator, createValue, getWhiteSpace, isContextDependent, isValid, normalizeWhiteSpace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

base

protected final DatatypeBase base
Constructor Detail

RestrictDatatype

RestrictDatatype(DatatypeBase base)

RestrictDatatype

RestrictDatatype(DatatypeBase base,
                 int whiteSpace)
Method Detail

lexicallyAllows

boolean lexicallyAllows(String str)
Specified by:
lexicallyAllows in class DatatypeBase

allowsValue

boolean allowsValue(String str,
                    ValidationContext vc)
Overrides:
allowsValue in class DatatypeBase

getOrderRelation

OrderRelation getOrderRelation()
Overrides:
getOrderRelation in class DatatypeBase

getMeasure

Measure getMeasure()
Overrides:
getMeasure in class DatatypeBase

getValue

Object getValue(String str,
                ValidationContext vc)
Specified by:
getValue in class DatatypeBase

getPrimitive

DatatypeBase getPrimitive()
Overrides:
getPrimitive in class DatatypeBase

getIdType

public int getIdType()
Description copied from interface: Datatype
Checks if the ID/IDREF semantics is associated with this datatype.

This method is introduced to support the RELAX NG DTD compatibility spec. (Of course it's always free to use this method for other purposes.)

If you are implementing a datatype library and have no idea about the "RELAX NG DTD compatibility" thing, just return ID_TYPE_NULL is fine.

Specified by:
getIdType in interface Datatype
Overrides:
getIdType in class DatatypeBase
Returns:
If this datatype doesn't have any ID/IDREF semantics, it returns Datatype.ID_TYPE_NULL. If it has such a semantics (for example, XSD:ID, XSD:IDREF and comp:ID type), then it returns Datatype.ID_TYPE_ID, Datatype.ID_TYPE_IDREF or Datatype.ID_TYPE_IDREFS.

sameValue

public boolean sameValue(Object value1,
                         Object value2)
Description copied from interface: Datatype
Tests the equality of two value objects which were originally created by the createValue method of this object. The behavior is undefined if objects not created by this type are passed. It is the caller's responsibility to ensure that value objects belong to this type.

Specified by:
sameValue in interface Datatype
Overrides:
sameValue in class DatatypeBase
Returns:
true if two value objects are considered equal according to the definition of this datatype; false if otherwise.

valueHashCode

public int valueHashCode(Object value)
Description copied from interface: Datatype
Computes the hash code for a value object, which is consistent with the sameValue method.

Specified by:
valueHashCode in interface Datatype
Overrides:
valueHashCode in class DatatypeBase
Returns:
hash code for the specified value object.