com.azure.resourcemanager.mediaservices.fluent.models.LiveEventTrackEventInner Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-mediaservices Show documentation
Show all versions of azure-resourcemanager-mediaservices Show documentation
This package contains Microsoft Azure SDK for MediaServices Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. This Swagger was generated by the API Framework. Package tag package-account-2023-01.
The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.mediaservices.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.mediaservices.models.LiveEventTrackEventData;
import com.azure.resourcemanager.mediaservices.models.LiveEventTrackEventType;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
/**
* The live event track event.
*/
@Fluent
public final class LiveEventTrackEventInner implements JsonSerializable {
/*
* The type of the track event.
*/
private LiveEventTrackEventType eventType;
/*
* The time event raised.
*/
private OffsetDateTime eventTime;
/*
* Event data.
*/
private LiveEventTrackEventData data;
/**
* Creates an instance of LiveEventTrackEventInner class.
*/
public LiveEventTrackEventInner() {
}
/**
* Get the eventType property: The type of the track event.
*
* @return the eventType value.
*/
public LiveEventTrackEventType eventType() {
return this.eventType;
}
/**
* Set the eventType property: The type of the track event.
*
* @param eventType the eventType value to set.
* @return the LiveEventTrackEventInner object itself.
*/
public LiveEventTrackEventInner withEventType(LiveEventTrackEventType eventType) {
this.eventType = eventType;
return this;
}
/**
* Get the eventTime property: The time event raised.
*
* @return the eventTime value.
*/
public OffsetDateTime eventTime() {
return this.eventTime;
}
/**
* Set the eventTime property: The time event raised.
*
* @param eventTime the eventTime value to set.
* @return the LiveEventTrackEventInner object itself.
*/
public LiveEventTrackEventInner withEventTime(OffsetDateTime eventTime) {
this.eventTime = eventTime;
return this;
}
/**
* Get the data property: Event data.
*
* @return the data value.
*/
public LiveEventTrackEventData data() {
return this.data;
}
/**
* Set the data property: Event data.
*
* @param data the data value to set.
* @return the LiveEventTrackEventInner object itself.
*/
public LiveEventTrackEventInner withData(LiveEventTrackEventData data) {
this.data = data;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (data() != null) {
data().validate();
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("eventType", this.eventType == null ? null : this.eventType.toString());
jsonWriter.writeStringField("eventTime",
this.eventTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.eventTime));
jsonWriter.writeJsonField("data", this.data);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of LiveEventTrackEventInner from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of LiveEventTrackEventInner 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 LiveEventTrackEventInner.
*/
public static LiveEventTrackEventInner fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
LiveEventTrackEventInner deserializedLiveEventTrackEventInner = new LiveEventTrackEventInner();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("eventType".equals(fieldName)) {
deserializedLiveEventTrackEventInner.eventType
= LiveEventTrackEventType.fromString(reader.getString());
} else if ("eventTime".equals(fieldName)) {
deserializedLiveEventTrackEventInner.eventTime = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("data".equals(fieldName)) {
deserializedLiveEventTrackEventInner.data = LiveEventTrackEventData.fromJson(reader);
} else {
reader.skipChildren();
}
}
return deserializedLiveEventTrackEventInner;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy