JsonFieldWithDefault Class

  • java.lang.Object
    • com.azure.resourcemanager.eventgrid.models.JsonFieldWithDefault

Implements

public final class JsonFieldWithDefault
implements JsonSerializable<JsonFieldWithDefault>

This is used to express the source of an input schema mapping for a single target field in the Event Grid Event schema. This is currently used in the mappings for the 'subject', 'eventtype' and 'dataversion' properties. This represents a field in the input event schema along with a default value to be used, and at least one of these two properties should be provided.

Constructor Summary

Constructor Description
JsonFieldWithDefault()

Creates an instance of JsonFieldWithDefault class.

Method Summary

Modifier and Type Method and Description
String defaultValue()

Get the defaultValue property: The default value to be used for mapping when a SourceField is not provided or if there's no property with the specified name in the published JSON event payload.

static JsonFieldWithDefault fromJson(JsonReader jsonReader)

Reads an instance of JsonFieldWithDefault from the JsonReader.

String sourceField()

Get the sourceField property: Name of a field in the input event schema that's to be used as the source of a mapping.

JsonWriter toJson(JsonWriter jsonWriter)
void validate()

Validates the instance.

JsonFieldWithDefault withDefaultValue(String defaultValue)

Set the defaultValue property: The default value to be used for mapping when a SourceField is not provided or if there's no property with the specified name in the published JSON event payload.

JsonFieldWithDefault withSourceField(String sourceField)

Set the sourceField property: Name of a field in the input event schema that's to be used as the source of a mapping.

Methods inherited from java.lang.Object

Constructor Details

JsonFieldWithDefault

public JsonFieldWithDefault()

Creates an instance of JsonFieldWithDefault class.

Method Details

defaultValue

public String defaultValue()

Get the defaultValue property: The default value to be used for mapping when a SourceField is not provided or if there's no property with the specified name in the published JSON event payload.

Returns:

the defaultValue value.

fromJson

public static JsonFieldWithDefault fromJson(JsonReader jsonReader)

Reads an instance of JsonFieldWithDefault from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of JsonFieldWithDefault 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 JsonFieldWithDefault.

sourceField

public String sourceField()

Get the sourceField property: Name of a field in the input event schema that's to be used as the source of a mapping.

Returns:

the sourceField value.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

validate

public void validate()

Validates the instance.

withDefaultValue

public JsonFieldWithDefault withDefaultValue(String defaultValue)

Set the defaultValue property: The default value to be used for mapping when a SourceField is not provided or if there's no property with the specified name in the published JSON event payload.

Parameters:

defaultValue - the defaultValue value to set.

Returns:

the JsonFieldWithDefault object itself.

withSourceField

public JsonFieldWithDefault withSourceField(String sourceField)

Set the sourceField property: Name of a field in the input event schema that's to be used as the source of a mapping.

Parameters:

sourceField - the sourceField value to set.

Returns:

the JsonFieldWithDefault object itself.

Applies to

Azure SDK for Java

Preview