public String convertToLexicalValue( Object value, SerializationContext context ) { return baseType.convertToLexicalValue(value,context); }
public ConcreteType getConcreteType() { return baseType.getConcreteType(); }
final public DataTypeWithFacet getFacetObject( String facetName ) { if(this.facetName.equals(facetName)) return this; else return baseType.getFacetObject(facetName); }
public FinalComponent( XSDatatypeImpl baseType, int finalValue ) { this( baseType.getNamespaceUri(), baseType.getName(), baseType, finalValue ); }
final public boolean isValid( String literal, ValidationContext context ) { // step.1 white space processing literal = whiteSpace.process(literal); if( needValueCheck() ) // constraint facet that needs computation of value is specified. return _createValue(literal,context)!=null; else // lexical validation is enough. return checkFormat(literal,context); }
final Vector ns = new Vector(); String lex = dt.convertToLexicalValue(values[i], new SerializationContext() { public String getNamespacePrefix(String namespaceURI) { int cnt = ns.size() / 2; boolean allowed = dt.isValid(lex, new ValidationContext() { ns.add(dt.getConcreteType().getName());
/** 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) ); } }
protected String generateList(XSDatatypeImpl dti, ContextProviderImpl context) { try { ListType base = (ListType)dti.getConcreteType(); LengthFacet lf = (LengthFacet)dti.getFacetObject(XSDatatype.FACET_LENGTH); int n; // compute # of items into this value. if(lf!=null) { n = lf.length; } else { MaxLengthFacet xlf = (MaxLengthFacet)dti.getFacetObject(XSDatatype.FACET_MAXLENGTH); int max = (xlf!=null)?xlf.maxLength:16; MinLengthFacet nlf = (MinLengthFacet)dti.getFacetObject(XSDatatype.FACET_MINLENGTH); int min = (nlf!=null)?nlf.minLength:0; n = random.nextInt(max-min)+min; } String s=""; for( int i=0; i<n; i++ ) s += " " + generate(base.itemType,context) + " "; return s; } catch( GenerationException ge ) { return null; } }
private static void add( Map m, XSDatatypeImpl type ) { final String name = type.getName(); if( name==null ) throw new IllegalArgumentException("anonymous type"); if( m.containsKey(name) ) // this error is considered as an assertion, // since this object doesn't allow external programs to // add types to the object. throw new IllegalArgumentException("multiple definition"); m.put( name, type ); }
public static String localize( String prop ) { return localize( prop, null ); } public static String localize( String prop, Object arg1 ) {
protected final boolean checkFormat( String content, ValidationContext context ) { // Are #x9, #xD, and #xA allowed as a separator, or not? StringTokenizer tokens = new StringTokenizer(content); while( tokens.hasMoreTokens() ) if(!itemType.isValid(tokens.nextToken(),context)) return false; return true; }
public void _checkValid( String content, ValidationContext context ) throws DatatypeException { baseType._checkValid(content,context); }
public Object _createJavaObject( String literal, ValidationContext context ) { return baseType._createJavaObject(literal,context); }
public Object _createValue( String literal, ValidationContext context ) { Object o = baseType._createValue(literal,context); if(o==null || !values.contains(o)) return null; return o; }
protected final boolean checkFormat( String content, ValidationContext context ) { for( int i=0; i<memberTypes.length; i++ ) if( memberTypes[i].checkFormat(content,context) ) return true; return false; }
final Vector ns = new Vector(); String lex = dt.convertToLexicalValue(values[i], new SerializationContext() { public String getNamespacePrefix(String namespaceURI) { int cnt = ns.size() / 2; boolean allowed = dt.isValid(lex, new ValidationContext() { ns.add(dt.getConcreteType().getName());
/** 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) ); } }
final public boolean isValid( String literal, ValidationContext context ) { // step.1 white space processing literal = whiteSpace.process(literal); if( needValueCheck() ) // constraint facet that needs computation of value is specified. return _createValue(literal,context)!=null; else // lexical validation is enough. return checkFormat(literal,context); }
public FinalComponent( XSDatatypeImpl baseType, int finalValue ) { this( baseType.getNamespaceUri(), baseType.getName(), baseType, finalValue ); }
private static void add( Map m, XSDatatypeImpl type ) { final String name = type.getName(); if( name==null ) throw new IllegalArgumentException("anonymous type"); if( m.containsKey(name) ) // this error is considered as an assertion, // since this object doesn't allow external programs to // add types to the object. throw new IllegalArgumentException("multiple definition"); m.put( name, type ); }