com.github.pgelinas.jackson.javax.json.JacksonNumber Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jackson-javax-json Show documentation
Show all versions of jackson-javax-json Show documentation
An alternate implementation of JSR-353 based on Jackson, which aims to bring better performance and configurability.
The newest version!
package com.github.pgelinas.jackson.javax.json;
import java.math.*;
import javax.json.*;
import com.fasterxml.jackson.databind.node.*;
public class JacksonNumber extends JacksonValueNode implements JsonNumber {
public JacksonNumber(NumericNode node) {
super(node);
}
@Override
public boolean isIntegral() {
return _delegate.isIntegralNumber();
}
@Override
public int intValue() {
return _delegate.intValue();
}
@Override
public int intValueExact() {
if(!_delegate.isInt()) throw new ArithmeticException();
return _delegate.intValue();
}
@Override
public long longValue() {
return _delegate.longValue();
}
@Override
public long longValueExact() {
if(!_delegate.isLong() && !_delegate.isInt()) throw new ArithmeticException();
return _delegate.longValue();
}
@Override
public BigInteger bigIntegerValue() {
return _delegate.bigIntegerValue();
}
@Override
public BigInteger bigIntegerValueExact() {
if(!_delegate.isIntegralNumber()) throw new ArithmeticException();
return _delegate.bigIntegerValue();
}
@Override
public double doubleValue() {
return _delegate.doubleValue();
}
@Override
public BigDecimal bigDecimalValue() {
return _delegate.decimalValue();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy