Class FieldValue
java.lang.Object
com.azure.ai.formrecognizer.models.FieldValue
Represents the strongly-typed value of a field recognized from the input document and provides
methods for converting it to the appropriate type.
-
Constructor Summary
ConstructorDescriptionFieldValue
(Object value, FieldValueType valueType) Constructs a FieldValue object -
Method Summary
Modifier and TypeMethodDescriptionGets the value of the field as a country or region in the world.asDate()
Gets the value of the field as aLocalDate
.asFloat()
Gets the value of the field as aFloat
.asList()
Gets the value of the field as aList
.asLong()
Gets the value of the field as aLong
.asMap()
Gets the value of the field as aMap
.Gets the value of the field as a phone number.Gets the value of the field as a selection mark state.asString()
Gets the value of the field as aString
.asTime()
Gets the value of the field as aLocalTime
.Gets the type of the value of the field.
-
Constructor Details
-
FieldValue
Constructs a FieldValue object- Parameters:
value
- The actual value of the field.valueType
- The type of the field.
-
-
Method Details
-
getValueType
Gets the type of the value of the field.- Returns:
- the
type
of the field.
-
asString
Gets the value of the field as aString
.- Returns:
- the value of the field as a
String
. - Throws:
UnsupportedOperationException
- ifgetValueType()
is notFieldValueType.STRING
.
-
asLong
Gets the value of the field as aLong
.- Returns:
- the value of the field as a
Long
. - Throws:
UnsupportedOperationException
- ifgetValueType()
is notFieldValueType.LONG
.
-
asFloat
Gets the value of the field as aFloat
.- Returns:
- the value of the field as a
Float
. - Throws:
UnsupportedOperationException
- ifgetValueType()
is notFieldValueType.FLOAT
.
-
asDate
Gets the value of the field as aLocalDate
.- Returns:
- the value of the field as a
LocalDate
. - Throws:
UnsupportedOperationException
- ifgetValueType()
is notFieldValueType.DATE
.
-
asTime
Gets the value of the field as aLocalTime
.- Returns:
- the value of the field as a
LocalTime
. - Throws:
UnsupportedOperationException
- ifgetValueType()
is notFieldValueType.TIME
.
-
asPhoneNumber
Gets the value of the field as a phone number.- Returns:
- the value of the field as a phone number.
- Throws:
UnsupportedOperationException
- ifgetValueType()
is notFieldValueType.PHONE_NUMBER
.
-
asList
Gets the value of the field as aList
.- Returns:
- the value of the field as an unmodifiable
List
. - Throws:
UnsupportedOperationException
- ifgetValueType()
is notFieldValueType.LIST
.
-
asMap
Gets the value of the field as aMap
.- Returns:
- the value of the field as an unmodifiable
Map
. - Throws:
UnsupportedOperationException
- ifgetValueType()
is notFieldValueType.MAP
.
-
asSelectionMarkState
Gets the value of the field as a selection mark state.- Returns:
- the value of the field as an unmodifiable selection mark state.
- Throws:
UnsupportedOperationException
- ifgetValueType()
is notFieldValueType.SELECTION_MARK_STATE
.
-
asCountryRegion
Gets the value of the field as a country or region in the world.- Returns:
- the value of the field as COUNTRY_REGION.
- Throws:
UnsupportedOperationException
- ifgetValueType()
is notFieldValueType.COUNTRY_REGION
.
-