Class SimpleField
- java.lang.Object
-
- com.mindee.v2.parsing.inference.field.BaseField
-
- com.mindee.v2.parsing.inference.field.SimpleField
-
public final class SimpleField extends BaseField
Field holding a single scalar value.
-
-
Constructor Summary
Constructors Constructor Description SimpleField(Object value, FieldConfidence confidence, List<FieldLocation> locations)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(Object other)booleanequals(Object o)BigDecimalgetBigDecimalValue()Retrieves the value of the field as aBigDecimal.BooleangetBooleanValue()Retrieves the value of the field as aBoolean.DoublegetDoubleValue()Retrieves the value of the field as aDouble.StringgetStringValue()Retrieves the value of the field as aString.ObjectgetValue()Value (string, boolean, double, ornull).inthashCode()StringtoString()-
Methods inherited from class com.mindee.v2.parsing.inference.field.BaseField
getConfidence, getLocations, setConfidence, setLocations
-
-
-
-
Constructor Detail
-
SimpleField
public SimpleField(Object value, FieldConfidence confidence, List<FieldLocation> locations)
-
-
Method Detail
-
getStringValue
public String getStringValue() throws ClassCastException
Retrieves the value of the field as aString.- Returns:
- the field value as a string
- Throws:
ClassCastException- if the value cannot be cast to a string
-
getDoubleValue
public Double getDoubleValue() throws ClassCastException
Retrieves the value of the field as aDouble.Accepts any
Number— the wire deserializer stores numeric values asBigDecimalto preserve precision, but programmatically-constructed fields may hold aDouble,Integer,Long, etc. PrefergetBigDecimalValue()when precision matters.- Returns:
- the field value as a Double (may lose precision)
- Throws:
ClassCastException- if the value is not aNumber
-
getBigDecimalValue
public BigDecimal getBigDecimalValue() throws ClassCastException
Retrieves the value of the field as aBigDecimal.Accepts any
Number. Non-BigDecimalnumbers are converted via their string representation to preserve as many digits as possible.- Returns:
- the field value as a BigDecimal
- Throws:
ClassCastException- if the value is not aNumber
-
getBooleanValue
public Boolean getBooleanValue() throws ClassCastException
Retrieves the value of the field as aBoolean.- Returns:
- the field value as a Boolean
- Throws:
ClassCastException- if the value cannot be cast to a Boolean
-
getValue
public Object getValue()
Value (string, boolean, double, ornull).
-
-