public void setData(Object data) { String s = datatype.convertToLexicalValue(data, this); validate(s); this.text = s; this.data = data; }
protected void validate(String txt) throws IllegalArgumentException { try { datatype.checkValid(txt, this); } catch (DatatypeException e) { throw new IllegalArgumentException(e.getMessage()); } }
protected Object convertToValue(String txt) { if (datatype instanceof DatabindableDatatype) { DatabindableDatatype bindable = (DatabindableDatatype) datatype; return bindable.createJavaObject(txt, this); } else { return datatype.createValue(txt, this); } } }
public XSDatatype getAncestorBuiltinType() { XSDatatype dt = this; while( !XMLSCHEMA_NSURI.equals(dt.getNamespaceUri()) ) dt = dt.getBaseType(); return dt; }
public final Expression createData( XSDatatype dt ) { String ns = dt.getNamespaceUri(); if(ns==null) ns="\u0000"; // use something that doesn't collide with others. return createData( dt, new StringPair(ns,dt.displayName()) ); }
public String getType(Datatype datatype, Datatype originalDatatype) { if (datatype instanceof XSDatatype) { final XSDatatype xsDatatype = (XSDatatype) datatype; final String namespaceUri = xsDatatype.getNamespaceUri(); final String localPart = xsDatatype.getName(); final QName qName = localPart == null ? null : new QName(namespaceUri, localPart); if (datatypeMap.keySet().contains(qName)) { return ((DatatypeResolver) datatypeMap.get(qName)).getType(originalDatatype); } else { // datatype. return getType(xsDatatype.getBaseType(), originalDatatype); } } return null; }
/** Creates this object from existing XSDatatype. */ public XSDatatypeExp( XSDatatype dt, ExpressionPool _pool ) { super(dt.getName()); this.namespaceUri = dt.getNamespaceUri(); this.dt = dt; this.pool = _pool; this.ownerState = null; this.renderer = null; super.exp = _pool.createData(dt); }
x = x.getBaseType(); continue; x = x.getBaseType(); continue; writer.start("data", new String[] { "type", x.getName()});
protected void fail( Datatype dt ) { throw new GenerationException("unable to generate value for this datatype: " + (( dt instanceof XSDatatype )?((XSDatatype)dt).displayName():dt.toString()) ); }
public Type getBaseType() { XSDatatype base = dt.getBaseType(); if(base==null) return getType(complexUrType); else return getType(base); } public Object getCore() { return dt; }
if( base.getVariety()==VARIETY_UNION ) { t = t.getBaseType(); XSDatatypeImpl[] memberTypes = ((UnionType)t).memberTypes; for( int i=0; i<memberTypes.length; i++ ) if( base==derived ) return true; derived = derived.getBaseType();
/** * @see #isDerivedTypeOf(ComplexTypeExp,int) */ public boolean isDerivedTypeOf( XSDatatype baseType, int constraint ) { ComplexTypeExp derived = this; while(true) { if( derived.complexBaseType==null ) { if( derived.simpleBaseType!=null ) return derived.simpleBaseType.getCreatedType().isDerivedTypeOf( baseType, (constraint&RESTRICTION)==0 ); else return false; } if( (derived.derivationMethod&constraint)!=0 ) return false; // this type of derivation is prohibited. derived = derived.complexBaseType; } } public boolean isDerivedTypeOf( XMLSchemaTypeExp exp, int constraint ) {
/** * gets the facet object that restricts the specified facet * * @return null * if no such facet object exists. */ public DataTypeWithFacet getFacetObject( String facetName ) { XSDatatype dt = getBaseType(); if(dt!=null) return dt.getFacetObject(facetName); else return null; }
public XSDatatype getAncestorBuiltinType() { XSDatatype dt = this; while( !XMLSCHEMA_NSURI.equals(dt.getNamespaceUri()) ) dt = dt.getBaseType(); return dt; }
public final Expression createData( XSDatatype dt ) { String ns = dt.getNamespaceUri(); if(ns==null) ns="\u0000"; // use something that doesn't collide with others. return createData( dt, new StringPair(ns,dt.displayName()) ); }
/** Creates this object from existing XSDatatype. */ public XSDatatypeExp( XSDatatype dt, ExpressionPool _pool ) { super(dt.getName()); this.namespaceUri = dt.getNamespaceUri(); this.dt = dt; this.pool = _pool; this.ownerState = null; this.renderer = null; super.exp = _pool.createData(dt); }
x = x.getBaseType(); continue; x = x.getBaseType(); continue; writer.start("data", new String[] { "type", x.getName()});
public final Expression createValue( XSDatatype dt, Object value ) { return createValue( dt, new StringPair("",dt.displayName()), value ); }
public Type getBaseType() { XSDatatype base = dt.getBaseType(); if(base==null) return getType(complexUrType); else return getType(base); } public Object getCore() { return dt; }