@Override protected Number fromLexicalForm(final String lexicalForm) throws InvalidLiteralException { try { final int n = DatatypeConverter.parseInt(lexicalForm); if (n < Byte.MIN_VALUE || n > Byte.MAX_VALUE) throw new InvalidLiteralException(getName(), lexicalForm); return Byte.valueOf((byte) n); } catch (final NumberFormatException e) { throw new InvalidLiteralException(getName(), lexicalForm, e); } } }
@Override protected Number fromLexicalForm(final String lexicalForm) throws InvalidLiteralException { try { final int n = DatatypeConverter.parseInt(lexicalForm); if (n < Byte.MIN_VALUE || n > Byte.MAX_VALUE) throw new InvalidLiteralException(getName(), lexicalForm); return Byte.valueOf((byte) n); } catch (final NumberFormatException e) { throw new InvalidLiteralException(getName(), lexicalForm, e); } } }
kb.addRange(p, ATermUtils.makeRestrictedDatatype(XSDInteger.getInstance().getName(), new ATermAppl[] { ATermUtils.makeFacetRestriction(Facet.XSD.MIN_INCLUSIVE.getName(), ATermUtils.makeTypedLiteral(Byte.toString(MIN), XSDByte.getInstance().getName())), ATermUtils.makeFacetRestriction(Facet.XSD.MAX_INCLUSIVE.getName(), ATermUtils.makeTypedLiteral(Byte.toString(MAX), XSDByte.getInstance().getName())) }));