Source:
private static FormField<?> setFormField(FieldData labelText, String key, FieldValue fieldValue, FieldData valueText, Integer pageNumber, List<ReadResult> readResults) { FormField<?> value; switch (fieldValue.getType()) { case PHONE_NUMBER: value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, key, fieldValue.getValuePhoneNumber(), valueText, FieldValueType.PHONE_NUMBER); break; case STRING: value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, key, fieldValue.getValueString(), valueText, FieldValueType.STRING); break; case TIME: LocalTime fieldTime = fieldValue.getValueTime() == null ? null : LocalTime .parse(fieldValue.getValueTime(), DateTimeFormatter.ofPattern("HH:mm:ss")); value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, key, fieldTime, valueText, FieldValueType.TIME); break; case DATE: value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, key, fieldValue.getValueDate(), valueText, FieldValueType.DATE); break; case INTEGER: value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, key, fieldValue.getValueInteger(), valueText, FieldValueType.INTEGER); break; case NUMBER: value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, key, fieldValue.getValueNumber(), valueText, FieldValueType.FLOAT); break; case ARRAY: value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), null, key, toFormFieldArray(fieldValue.getValueArray(), readResults), null, FieldValueType.LIST); break; case OBJECT: value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, key, toFormFieldObject(fieldValue.getValueObject(), pageNumber, readResults), valueText, FieldValueType.MAP); break; default: throw LOGGER.logExceptionAsError(new RuntimeException("FieldValue Type not supported")); } return value; }

Target:
private static FormField<?> setFormField(FieldData labelText, String key, FieldValue fieldValue, FieldData valueText, Integer pageNumber, List<ReadResult> readResults) { FormField<?> value; switch (fieldValue.getType()) { case PHONE_NUMBER: value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, key, fieldValue.getValuePhoneNumber(), valueText, FieldValueType.PHONE_NUMBER); break; case STRING: value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, key, fieldValue.getValueString(), valueText, FieldValueType.STRING); break; case TIME: LocalTime fieldTime = fieldValue.getValueTime() == null ? null : LocalTime .parse(fieldValue.getValueTime(), DateTimeFormatter.ofPattern("HH:mm:ss")); value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, key, fieldTime, valueText, FieldValueType.TIME); break; case DATE: value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, key, fieldValue.getValueDate(), valueText, FieldValueType.DATE); break; case INTEGER: value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, key, fieldValue.getValueInteger(), valueText, FieldValueType.LONG); break; case NUMBER: value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, key, fieldValue.getValueNumber(), valueText, FieldValueType.DOUBLE); break; case ARRAY: value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), null, key, toFormFieldArray(fieldValue.getValueArray(), readResults), null, FieldValueType.LIST); break; case OBJECT: value = new FormField<>(setDefaultConfidenceValue(fieldValue.getConfidence()), labelText, key, toFormFieldObject(fieldValue.getValueObject(), pageNumber, readResults), valueText, FieldValueType.MAP); break; default: throw LOGGER.logExceptionAsError(new RuntimeException("FieldValue Type not supported")); } return value; }