TypeIncubator incubator = new TypeIncubator(baseType); ValidationContext context = null; incubator.addFacet(name, value, fixed, context); return incubator.derive("", newTypeName); } catch (DatatypeException e) { onSchemaError("Invalid restriction: " + e.getMessage()
protected MinLengthFacet( String nsUri, String typeName, XSDatatypeImpl baseType, TypeIncubator facets ) throws DatatypeException { this(nsUri,typeName,baseType, facets.getNonNegativeInteger(FACET_MINLENGTH), facets.isFixed(FACET_MINLENGTH)); }
if (isEmpty()) { if (contains(exclusiveFacetPairs[i][0]) && contains(exclusiveFacetPairs[i][1])) throw new DatatypeException( XSDatatypeImpl.localize( if (contains(XSDatatypeImpl.FACET_TOTALDIGITS)) r = new TotalDigitsFacet( newLocalName, r, getPositiveInteger(XSDatatype.FACET_TOTALDIGITS), isFixed(XSDatatype.FACET_TOTALDIGITS)); if (contains(XSDatatypeImpl.FACET_FRACTIONDIGITS)) r = new FractionDigitsFacet( newLocalName, r, getNonNegativeInteger(XSDatatype.FACET_FRACTIONDIGITS), isFixed(XSDatatype.FACET_FRACTIONDIGITS)); if (contains(XSDatatypeImpl.FACET_MININCLUSIVE)) r = new MinInclusiveFacet( newLocalName, r, getFacet(XSDatatype.FACET_MININCLUSIVE),
/** @deprecated */ public XSDatatypeImpl derive(String newName) throws DatatypeException { return derive("", newName); }
/** * adds a facet to the type. * * @deprecated * please use the addFacet method, which is better named. */ public void add(String name, String strValue, boolean fixed, ValidationContext context) throws DatatypeException { addFacet(name, strValue, fixed, context); }
DatatypeBuilderImpl( XSDatatype baseType ) { incubator = new TypeIncubator(baseType); }
public void testDerivationByRestriction() throws DatatypeException { TypeIncubator inc = new TypeIncubator( new FinalComponent( StringType.theInstance, XSDatatype.DERIVATION_BY_RESTRICTION ) ); try { inc.derive("test","test"); fail("should throw Exception here"); } catch( DatatypeException bte ) {;} }
/** * gets a value of non-repeatable facet as a positive integer * * the behavior is undefined when the specified facetName doesn't exist * in this map. * * @exception DatatypeException * if the parameter cannot be parsed as a positive integer */ public int getPositiveInteger(String facetName) throws DatatypeException { try { // TODO : is this implementation correct? int value = Integer.parseInt((String)getFacet(facetName)); if (value > 0) return value; } catch (NumberFormatException e) { // let's try BigInteger to see if the value is actually positive try { // if we can parse it in BigInteger, then treat is as Integer.MAX_VALUE // this will work for most cases, I suppose. if (new BigInteger((String)getFacet(facetName)).signum() > 0) return Integer.MAX_VALUE; } catch (NumberFormatException ee) { ; } } throw new DatatypeException( XSDatatypeImpl.localize(XSDatatypeImpl.ERR_FACET_MUST_BE_POSITIVE_INTEGER, facetName)); }
if (isEmpty()) { if (contains(exclusiveFacetPairs[i][0]) && contains(exclusiveFacetPairs[i][1])) throw new DatatypeException( XSDatatypeImpl.localize( if (contains(XSDatatypeImpl.FACET_TOTALDIGITS)) r = new TotalDigitsFacet( newLocalName, r, getPositiveInteger(XSDatatype.FACET_TOTALDIGITS), isFixed(XSDatatype.FACET_TOTALDIGITS)); if (contains(XSDatatypeImpl.FACET_FRACTIONDIGITS)) r = new FractionDigitsFacet( newLocalName, r, getNonNegativeInteger(XSDatatype.FACET_FRACTIONDIGITS), isFixed(XSDatatype.FACET_FRACTIONDIGITS)); if (contains(XSDatatypeImpl.FACET_MININCLUSIVE)) r = new MinInclusiveFacet( newLocalName, r, getFacet(XSDatatype.FACET_MININCLUSIVE),
/** @deprecated */ public XSDatatypeImpl derive(String newName) throws DatatypeException { return derive("", newName); }
/** * adds a facet to the type. * * @deprecated * please use the addFacet method, which is better named. */ public void add(String name, String strValue, boolean fixed, ValidationContext context) throws DatatypeException { addFacet(name, strValue, fixed, context); }
DatatypeBuilderImpl( XSDatatype baseType ) { incubator = new TypeIncubator(baseType); }
final TypeIncubator ti = new TypeIncubator(baseType); String answer; try typeObj = ti.derive("anonymousURI","anonymousLocal");
/** * gets a value of non-repeatable facet as a positive integer * * the behavior is undefined when the specified facetName doesn't exist * in this map. * * @exception DatatypeException * if the parameter cannot be parsed as a positive integer */ public int getPositiveInteger(String facetName) throws DatatypeException { try { // TODO : is this implementation correct? int value = Integer.parseInt((String)getFacet(facetName)); if (value > 0) return value; } catch (NumberFormatException e) { // let's try BigInteger to see if the value is actually positive try { // if we can parse it in BigInteger, then treat is as Integer.MAX_VALUE // this will work for most cases, I suppose. if (new BigInteger((String)getFacet(facetName)).signum() > 0) return Integer.MAX_VALUE; } catch (NumberFormatException ee) { ; } } throw new DatatypeException( XSDatatypeImpl.localize(XSDatatypeImpl.ERR_FACET_MUST_BE_POSITIVE_INTEGER, facetName)); }
public XSDatatype render( XSDatatypeExp.RenderingContext context ) throws DatatypeException { TypeIncubator ti = new TypeIncubator( baseType.getType(context) ); Iterator itr = facets.iterator(); for( int i=0; i<facetSize; i++ ) { Facet f = (Facet)itr.next(); ti.addFacet( f.name, f.value, f.fixed, f.context ); } return ti.derive(nsUri,localName); } });
if (isEmpty()) { if (contains(exclusiveFacetPairs[i][0]) && contains(exclusiveFacetPairs[i][1])) throw new DatatypeException( XSDatatypeImpl.localize( if (contains(XSDatatypeImpl.FACET_TOTALDIGITS)) r = new TotalDigitsFacet( newLocalName, r, getPositiveInteger(XSDatatype.FACET_TOTALDIGITS), isFixed(XSDatatype.FACET_TOTALDIGITS)); if (contains(XSDatatypeImpl.FACET_FRACTIONDIGITS)) r = new FractionDigitsFacet( newLocalName, r, getNonNegativeInteger(XSDatatype.FACET_FRACTIONDIGITS), isFixed(XSDatatype.FACET_FRACTIONDIGITS)); if (contains(XSDatatypeImpl.FACET_MININCLUSIVE)) r = new MinInclusiveFacet( newLocalName, r, getFacet(XSDatatype.FACET_MININCLUSIVE),
public Datatype createDatatype() throws DatatypeException { return incubator.derive(null,null); } }
/** * adds a facet to the type. * * @deprecated * please use the addFacet method, which is better named. */ public void add(String name, String strValue, boolean fixed, ValidationContext context) throws DatatypeException { addFacet(name, strValue, fixed, context); }