Package com.cedarsoftware.util.io
Class Readers
java.lang.Object
com.cedarsoftware.util.io.Readers
All custom readers for json-io subclass this class. Special readers are not needed for handling
user-defined classes. However, special readers are built/supplied by json-io for many of the
primitive types and other JDK classes simply to allow for a more concise form.
- Author:
- John DeRegnaucourt ([email protected])
Copyright (c) Cedar Software LLC
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.*
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
static class
-
Method Summary
Modifier and TypeMethodDescriptionstatic BigDecimal
bigDecimalFrom
(Object value) static BigInteger
bigIntegerFrom
(Object value)
-
Method Details
-
bigIntegerFrom
- Parameters:
value
- to be converted to BigInteger. Can be a null which will return null. Can be BigInteger in which case it will be returned as-is. Can also be String, BigDecimal, Boolean (which will be returned as BigInteger.ZERO or .ONE), byte, short, int, long, float, or double. If an unknown type is passed in, an exception will be thrown.- Returns:
- a BigInteger from the given input. A best attempt will be made to support as many input types as possible. For example, if the input is a Boolean, a BigInteger of 1 or 0 will be returned. If the input is a String "", a null will be returned. If the input is a Double, Float, or BigDecimal, a BigInteger will be returned that retains the integer portion (fractional part is dropped). The input can be a Byte, Short, Integer, or Long.
-
bigDecimalFrom
- Parameters:
value
- to be converted to BigDecimal. Can be a null which will return null. Can be BigDecimal in which case it will be returned as-is. Can also be String, BigInteger, Boolean (which will be returned as BigDecimal.ZERO or .ONE), byte, short, int, long, float, or double. If an unknown type is passed in, an exception will be thrown.- Returns:
- a BigDecimal from the given input. A best attempt will be made to support as many input types as possible. For example, if the input is a Boolean, a BigDecimal of 1 or 0 will be returned. If the input is a String "", a null will be returned. The input can be a Byte, Short, Integer, Long, or BigInteger.
-