Freigeben über


ContentField Class

  • java.lang.Object
    • com.azure.ai.contentunderstanding.models.ContentField

Implements

public class ContentField
implements JsonSerializable<ContentField>

Field extracted from the content.

Constructor Summary

Modifier Constructor Description
protected ContentField()

Creates an instance of ContentField class.

Method Summary

Modifier and Type Method and Description
static ContentField fromJson(JsonReader jsonReader)

Reads an instance of ContentField from the JsonReader.

Double getConfidence()

Get the confidence property: Confidence of predicting the field value.

List<ContentSource> getSources()

Parses the encoded source string into typed content sources.

List<ContentSpan> getSpans()

Get the spans property: Span(s) associated with the field value in the markdown content.

ContentFieldType getType()

Get the type property: Semantic data type of the field value.

Object getValue()

Gets the value of the field, regardless of its type.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Constructor Details

ContentField

protected ContentField()

Creates an instance of ContentField class.

Method Details

fromJson

public static ContentField fromJson(JsonReader jsonReader)

Reads an instance of ContentField from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of ContentField if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If an error occurs while reading the ContentField.

getConfidence

public Double getConfidence()

Get the confidence property: Confidence of predicting the field value.

Returns:

the confidence value.

getSources

public List<ContentSource> getSources()

Parses the encoded source string into typed content sources. The returned list contains DocumentSource or AudioVisualSource instances depending on the wire format. Returns null if the source string is null or empty.

Returns:

an unmodifiable list of ContentSource instances, or null if no source is available.

getSpans

public List<ContentSpan> getSpans()

Get the spans property: Span(s) associated with the field value in the markdown content.

Returns:

the spans value.

getType

public ContentFieldType getType()

Get the type property: Semantic data type of the field value.

Returns:

the type value.

getValue

public Object getValue()

Gets the value of the field, regardless of its type. This base method returns Object. Each subclass also overrides this method with a covariant return type for compile-time type safety: - getValue() returns String - getValue() returns Double - getValue() returns Long - getValue() returns LocalDate - getValue() returns String - getValue() returns Boolean - getValue() returns Map - getValue() returns List - getValue() returns BinaryData When you have a reference to the specific subclass, use its typed getValue() to avoid casting. When you only have a ContentField reference, this method returns the value as Object.

Returns:

the field value, or null if not available.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to