org.eclipse.ditto.wot.model.Interaction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ditto-wot-model Show documentation
Show all versions of ditto-wot-model Show documentation
Eclipse Ditto is a framework for creating and managing digital twins in the IoT.
The newest version!
/*
* Copyright (c) 2022 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
* information regarding copyright ownership.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.eclipse.ditto.wot.model;
import java.util.Optional;
import javax.annotation.Nullable;
import javax.annotation.concurrent.Immutable;
import org.eclipse.ditto.base.model.json.Jsonifiable;
import org.eclipse.ditto.json.JsonArray;
import org.eclipse.ditto.json.JsonFactory;
import org.eclipse.ditto.json.JsonFieldDefinition;
import org.eclipse.ditto.json.JsonObject;
/**
* An Interaction describes how to interact with a Thing.
* W3C WoT defines three types of Interaction Affordances: {@link Property}s, {@link Action}s, and {@link Event}s.
*
* @see WoT TD InteractionAffordance
* @param the type of the Interaction.
* @param the type of the Interaction's Forms.
* @param the type of the Interaction's Form's FormElements.
* @since 2.4.0
*/
public interface Interaction, E extends FormElement, F extends Forms>
extends TypedJsonObject, Jsonifiable {
Optional getAtType();
Optional getDescription();
Optional getDescriptions();
Optional getTitle();
Optional getTitles();
Optional getForms();
Optional getUriVariables();
interface Builder, I extends Interaction, E extends FormElement, F extends Forms>
extends TypedJsonObjectBuilder {
B setAtType(@Nullable AtType atType);
B setTitle(@Nullable Title title);
B setTitles(@Nullable Titles titles);
B setDescription(@Nullable Description description);
B setDescriptions(@Nullable Descriptions descriptions);
B setForms(@Nullable F forms);
B setUriVariables(@Nullable UriVariables uriVariables);
}
/**
* An enumeration of the known {@link JsonFieldDefinition}s of an Interaction.
*/
@Immutable
final class InteractionJsonFields {
public static final JsonFieldDefinition AT_TYPE = JsonFactory.newStringFieldDefinition(
"@type");
public static final JsonFieldDefinition AT_TYPE_MULTIPLE = JsonFactory.newJsonArrayFieldDefinition(
"@type");
public static final JsonFieldDefinition TITLE = JsonFactory.newStringFieldDefinition(
"title");
public static final JsonFieldDefinition TITLES = JsonFactory.newJsonObjectFieldDefinition(
"titles");
public static final JsonFieldDefinition DESCRIPTION = JsonFactory.newStringFieldDefinition(
"description");
public static final JsonFieldDefinition DESCRIPTIONS = JsonFactory.newJsonObjectFieldDefinition(
"descriptions");
public static final JsonFieldDefinition FORMS = JsonFactory.newJsonArrayFieldDefinition(
"forms");
public static final JsonFieldDefinition URI_VARIABLES = JsonFactory.newJsonObjectFieldDefinition(
"uriVariables");
private InteractionJsonFields() {
throw new AssertionError();
}
}
}