本文整理了Java中java.math.BigInteger.shortValueExact()
方法的一些代码示例,展示了BigInteger.shortValueExact()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BigInteger.shortValueExact()
方法的具体详情如下:
包路径:java.math.BigInteger
类名称:BigInteger
方法名:shortValueExact
暂无
代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-queryalgebra-evaluation
@Override
protected Optional<Literal> createTypedLiteral(ValueFactory vf, BigInteger integerValue)
throws ArithmeticException
{
return Optional.of(vf.createLiteral(integerValue.shortValueExact()));
}
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-queryalgebra-evaluation
@Override
protected Optional<Literal> createTypedLiteral(ValueFactory vf, BigInteger integerValue)
throws ArithmeticException
{
return Optional.of(vf.createLiteral(integerValue.shortValueExact()));
}
}
代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-queryalgebra-evaluation
@Override
protected Optional<Literal> createTypedLiteral(ValueFactory vf, BigInteger integerValue)
throws ArithmeticException
{
if (integerValue.compareTo(BigInteger.ZERO) >= 0) {
return Optional.of(vf.createLiteral(String.valueOf(integerValue.shortValueExact()), getXsdDatatype()));
}
return Optional.empty();
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-queryalgebra-evaluation
@Override
protected Optional<Literal> createTypedLiteral(ValueFactory vf, BigInteger integerValue)
throws ArithmeticException
{
if (integerValue.compareTo(BigInteger.ZERO) >= 0) {
return Optional.of(vf.createLiteral(String.valueOf(integerValue.shortValueExact()), getXsdDatatype()));
}
return Optional.empty();
}
代码示例来源:origin: io.atlasmap/atlas-core
@AtlasConversionInfo(sourceType = FieldType.DECIMAL, targetType = FieldType.SHORT,
concerns = {AtlasConversionConcern.RANGE, AtlasConversionConcern.FRACTIONAL_PART})
public Short toShort(BigDecimal value) throws AtlasConversionException {
if (value == null) {
return null;
}
try {
return value.toBigInteger().shortValueExact();
} catch (ArithmeticException e) {
throw new AtlasConversionException(
String.format("BigDecimal %s is greater than Short.MAX_VALUE or less than Short.MIN_VALUE", value));
}
}
代码示例来源:origin: leangen/graphql-spqr
@Override
public Object parseValue(Object input) {
if (input instanceof Number || input instanceof String) {
try {
return new ShortNode(new BigInteger(input.toString()).shortValueExact());
} catch (ArithmeticException e) {
throw new CoercingParseValueException(input + " does not fit into a short without a loss of precision");
}
}
if (input instanceof ShortNode) {
return input;
}
throw valueParsingException(input, Number.class, String.class, ShortNode.class);
}
代码示例来源:origin: io.atlasmap/atlas-core
@AtlasConversionInfo(sourceType = FieldType.BIG_INTEGER, targetType = FieldType.SHORT,
concerns = AtlasConversionConcern.RANGE)
public Short toShort(BigInteger value) throws AtlasConversionException {
if (value == null) {
return null;
}
try {
return value.shortValueExact();
} catch (ArithmeticException e) {
throw new AtlasConversionException(
String.format("BigInteger %s is greater than Short.MAX_VALUE or less than Short.MIN_VALUE", value));
}
}
代码示例来源:origin: net.lecousin/core
return Byte.valueOf(value.byteValueExact());
if (short.class.equals(type) || Short.class.equals(type))
return Short.valueOf(value.shortValueExact());
if (int.class.equals(type) || Integer.class.equals(type))
return Integer.valueOf(value.intValueExact());
代码示例来源:origin: org.kopitubruk.util/JSONUtil
return Short.valueOf(bigInt.shortValueExact());
}catch ( ArithmeticException e ){
代码示例来源:origin: leangen/graphql-spqr
@Override
public Object parseLiteral(Object input) {
if (input instanceof IntValue) {
try {
return new ShortNode(((IntValue) input).getValue().shortValueExact());
} catch (ArithmeticException e) {
throw new CoercingParseLiteralException(input + " does not fit into a short without a loss of precision");
}
} else {
throw new CoercingParseLiteralException(errorMessage(input, IntValue.class));
}
}
});
内容来源于网络,如有侵权,请联系作者删除!