use of org.apache.xerces.xs.XSSimpleTypeDefinition in project webtools.sourceediting by eclipse.
the class XercesIntegerUserDefined method constructor.
public ResultSequence constructor(ResultSequence arg) throws DynamicError {
ResultSequence rs = ResultSequenceFactory.create_new();
if (arg.empty())
return rs;
// AnyAtomicType aat = (AnyAtomicType) arg.first();
Item aat = arg.first();
XSSimpleTypeDefinition simpletype = (XSSimpleTypeDefinition) typeInfo;
if (simpletype != null) {
if (simpletype.isDefinedFacet(XSSimpleTypeDefinition.FACET_MININCLUSIVE)) {
String minValue = simpletype.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MININCLUSIVE);
int iminValue = Integer.parseInt(minValue);
int actualValue = Integer.parseInt(aat.getStringValue());
if (actualValue < iminValue) {
throw DynamicError.invalidForCastConstructor();
}
}
if (simpletype.isDefinedFacet(XSSimpleTypeDefinition.FACET_MAXINCLUSIVE)) {
String maxValue = simpletype.getLexicalFacetValue(XSSimpleTypeDefinition.FACET_MAXINCLUSIVE);
int imaxValue = Integer.parseInt(maxValue);
int actualValue = Integer.parseInt(aat.getStringValue());
if (actualValue > imaxValue) {
throw DynamicError.invalidForCastConstructor();
}
}
}
return new XercesIntegerUserDefined(new BigInteger(aat.getStringValue()));
}
Aggregations