1 57 58 package com.sun.org.apache.xerces.internal.impl.dv.xs; 59 60 import com.sun.org.apache.xerces.internal.impl.dv.InvalidDatatypeValueException; 61 import com.sun.org.apache.xerces.internal.impl.dv.ValidationContext; 62 63 74 public abstract class TypeValidator { 75 76 public abstract short getAllowedFacets(); 78 79 public abstract Object getActualValue(String content, ValidationContext context) 84 throws InvalidDatatypeValueException; 85 86 public void checkExtraRules(Object value, ValidationContext context) throws InvalidDatatypeValueException { 90 } 91 92 97 public static final short LESS_THAN = -1; 99 public static final short EQUAL = 0; 100 public static final short GREATER_THAN = 1; 101 public static final short INDETERMINATE = 2; 102 103 public int compare(Object value1, Object value2) { 106 return -1; 107 } 108 109 public int getDataLength(Object value) { 112 return (value instanceof String ) ? ((String )value).length() : -1; 113 } 114 115 public int getTotalDigits(Object value) { 118 return -1; 119 } 120 121 public int getFractionDigits(Object value) { 124 return -1; 125 } 126 127 public static final boolean isDigit(char ch) { 129 return ch >= '0' && ch <= '9'; 130 } 131 132 public static final int getDigit(char ch) { 135 return isDigit(ch) ? ch - '0' : -1; 136 } 137 138 } | Popular Tags |