final protected void _checkValid(String content, ValidationContext context ) throws DatatypeException { // let the base type complain first. baseType._checkValid(content,context); // then see if the facet is satisfied. diagnoseByFacet(content,context); }
final public Object _createJavaObject( String literal, ValidationContext context ) { // TODO: this can be more efficient if(isValid(literal,context)) return baseType.createJavaObject(literal,context); else return null; } public String serializeJavaObject( Object value, SerializationContext context ) {
public FractionDigitsFacet( String nsUri, String typeName, XSDatatypeImpl baseType, int _scale, boolean _isFixed ) throws DatatypeException { super( nsUri, typeName, baseType, FACET_FRACTIONDIGITS, _isFixed ); scale = _scale; // loosened facet check DataTypeWithFacet o = baseType.getFacetObject(FACET_FRACTIONDIGITS); if(o!=null && ((FractionDigitsFacet)o).scale < this.scale ) throw new DatatypeException( localize( ERR_LOOSENED_FACET, FACET_FRACTIONDIGITS, o.displayName() ) ); // consistency with precision is checked in XSDatatypeImpl.derive method. }
String o1typeName = o1.getName(); String o2typeName = o2.getName(); XSDatatypeImpl.ERR_INCONSISTENT_FACETS_2, facetName1, o2.displayName(), facetName2)); XSDatatypeImpl.ERR_INCONSISTENT_FACETS_2, facetName2, o1.displayName(), facetName1));
/** * check (min,max) facet specification and makes sure that * they are consistent * * @exception DatatypeException * when two facets are inconsistent */ private static void checkRangeConsistency(XSDatatypeImpl newType, String facetName1, String facetName2) throws DatatypeException { DataTypeWithFacet o1 = newType.getFacetObject(facetName1); DataTypeWithFacet o2 = newType.getFacetObject(facetName2); if (o1 != null && o2 != null) { final int c = ((Comparator)o1.getConcreteType()).compare(((RangeFacet)o1).limitValue, ((RangeFacet)o2).limitValue); if (c == Comparator.GREATER) throw reportFacetInconsistency(newType.displayName(), o1, facetName1, o2, facetName2); } }
/** constructor for WhiteSpaceFacet */ DataTypeWithFacet( String nsUri, String typeName, XSDatatypeImpl baseType, String facetName, boolean _isFixed, WhiteSpaceProcessor whiteSpace ) throws DatatypeException { super(nsUri,typeName, whiteSpace); this.baseType = baseType; this.facetName = facetName; this.isFacetFixed = _isFixed; this.concreteType = baseType.getConcreteType(); needValueCheckFlag = baseType.needValueCheck(); int r = baseType.isFacetApplicable(facetName); switch(r) { case APPLICABLE: return; // this facet is applicable to this type. no problem. case NOT_ALLOWED: throw new DatatypeException( localize(ERR_NOT_APPLICABLE_FACET, facetName) ); case FIXED: throw new DatatypeException( localize(ERR_OVERRIDING_FIXED_FACET, facetName) ); } }
param("fractionDigits", Long.toString(((FractionDigitsFacet)dtf).scale)); } else if (dtf instanceof RangeFacet) { param(dtf.facetName, dtf.convertToLexicalValue(((RangeFacet)dtf).limitValue, null));
protected MaxLengthFacet( String nsUri, String typeName, XSDatatypeImpl baseType, int _maxLength, boolean _isFixed ) throws DatatypeException { super(nsUri,typeName,baseType,FACET_MAXLENGTH,_isFixed); this.maxLength = _maxLength; // loosened facet check DataTypeWithFacet o = baseType.getFacetObject(FACET_MAXLENGTH); if(o!=null && ((MaxLengthFacet)o).maxLength < this.maxLength ) throw new DatatypeException( localize( ERR_LOOSENED_FACET, FACET_MAXLENGTH, o.displayName() ) ); // consistency with minLength is checked in XSDatatypeImpl.derive method. }
String o1typeName = o1.getName(); String o2typeName = o2.getName(); XSDatatypeImpl.ERR_INCONSISTENT_FACETS_2, facetName1, o2.displayName(), facetName2)); XSDatatypeImpl.ERR_INCONSISTENT_FACETS_2, facetName2, o1.displayName(), facetName1));
/** * check (min,max) facet specification and makes sure that * they are consistent * * @exception DatatypeException * when two facets are inconsistent */ private static void checkRangeConsistency(XSDatatypeImpl newType, String facetName1, String facetName2) throws DatatypeException { DataTypeWithFacet o1 = newType.getFacetObject(facetName1); DataTypeWithFacet o2 = newType.getFacetObject(facetName2); if (o1 != null && o2 != null) { final int c = ((Comparator)o1.getConcreteType()).compare(((RangeFacet)o1).limitValue, ((RangeFacet)o2).limitValue); if (c == Comparator.GREATER) throw reportFacetInconsistency(newType.displayName(), o1, facetName1, o2, facetName2); } }
/** constructor for WhiteSpaceFacet */ DataTypeWithFacet( String nsUri, String typeName, XSDatatypeImpl baseType, String facetName, boolean _isFixed, WhiteSpaceProcessor whiteSpace ) throws DatatypeException { super(nsUri,typeName, whiteSpace); this.baseType = baseType; this.facetName = facetName; this.isFacetFixed = _isFixed; this.concreteType = baseType.getConcreteType(); needValueCheckFlag = baseType.needValueCheck(); int r = baseType.isFacetApplicable(facetName); switch(r) { case APPLICABLE: return; // this facet is applicable to this type. no problem. case NOT_ALLOWED: throw new DatatypeException( localize(ERR_NOT_APPLICABLE_FACET, facetName) ); case FIXED: throw new DatatypeException( localize(ERR_OVERRIDING_FIXED_FACET, facetName) ); } }
param("fractionDigits", Long.toString(((FractionDigitsFacet)dtf).scale)); } else if (dtf instanceof RangeFacet) { param(dtf.facetName, dtf.convertToLexicalValue(((RangeFacet)dtf).limitValue, null));
protected LengthFacet( String nsUri, String typeName, XSDatatypeImpl baseType, int _length, boolean _isFixed ) throws DatatypeException { super(nsUri,typeName,baseType,FACET_LENGTH,_isFixed); length = _length; // loosened facet check DataTypeWithFacet o = baseType.getFacetObject(FACET_LENGTH); if(o!=null && ((LengthFacet)o).length != this.length ) throw new DatatypeException( localize(ERR_LOOSENED_FACET, FACET_LENGTH, o.displayName() ) ); // consistency with minLength/maxLength is checked in XSDatatypeImpl.derive method. }
String o1typeName = o1.getName(); String o2typeName = o2.getName(); XSDatatypeImpl.ERR_INCONSISTENT_FACETS_2, facetName1, o2.displayName(), facetName2)); XSDatatypeImpl.ERR_INCONSISTENT_FACETS_2, facetName2, o1.displayName(), facetName1));
/** * check (min,max) facet specification and makes sure that * they are consistent * * @exception DatatypeException * when two facets are inconsistent */ private static void checkRangeConsistency(XSDatatypeImpl newType, String facetName1, String facetName2) throws DatatypeException { DataTypeWithFacet o1 = newType.getFacetObject(facetName1); DataTypeWithFacet o2 = newType.getFacetObject(facetName2); if (o1 != null && o2 != null) { final int c = ((Comparator)o1.getConcreteType()).compare(((RangeFacet)o1).limitValue, ((RangeFacet)o2).limitValue); if (c == Comparator.GREATER) throw reportFacetInconsistency(newType.displayName(), o1, facetName1, o2, facetName2); } }
final protected void _checkValid(String content, ValidationContext context ) throws DatatypeException { // let the base type complain first. baseType._checkValid(content,context); // then see if the facet is satisfied. diagnoseByFacet(content,context); }
final public Object _createJavaObject( String literal, ValidationContext context ) { // TODO: this can be more efficient if(isValid(literal,context)) return baseType.createJavaObject(literal,context); else return null; } public String serializeJavaObject( Object value, SerializationContext context ) {
/** constructor for WhiteSpaceFacet */ DataTypeWithFacet( String nsUri, String typeName, XSDatatypeImpl baseType, String facetName, boolean _isFixed, WhiteSpaceProcessor whiteSpace ) throws DatatypeException { super(nsUri,typeName, whiteSpace); this.baseType = baseType; this.facetName = facetName; this.isFacetFixed = _isFixed; this.concreteType = baseType.getConcreteType(); needValueCheckFlag = baseType.needValueCheck(); int r = baseType.isFacetApplicable(facetName); switch(r) { case APPLICABLE: return; // this facet is applicable to this type. no problem. case NOT_ALLOWED: throw new DatatypeException( localize(ERR_NOT_APPLICABLE_FACET, facetName) ); case FIXED: throw new DatatypeException( localize(ERR_OVERRIDING_FIXED_FACET, facetName) ); } }