software.amazon.awssdk.services.iotfleetwise.model.NetworkInterface Maven / Gradle / Ivy
Show all versions of iotfleetwise Show documentation
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.iotfleetwise.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Represents a node and its specifications in an in-vehicle communication network. All signal decoders must be
* associated with a network node.
*
*
* To return this information about all the network interfaces specified in a decoder manifest, use the API operation.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class NetworkInterface implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField INTERFACE_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("interfaceId").getter(getter(NetworkInterface::interfaceId)).setter(setter(Builder::interfaceId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("interfaceId").build()).build();
private static final SdkField TYPE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("type")
.getter(getter(NetworkInterface::typeAsString)).setter(setter(Builder::type))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("type").build()).build();
private static final SdkField CAN_INTERFACE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("canInterface").getter(getter(NetworkInterface::canInterface)).setter(setter(Builder::canInterface))
.constructor(CanInterface::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("canInterface").build()).build();
private static final SdkField OBD_INTERFACE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("obdInterface").getter(getter(NetworkInterface::obdInterface)).setter(setter(Builder::obdInterface))
.constructor(ObdInterface::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("obdInterface").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(INTERFACE_ID_FIELD,
TYPE_FIELD, CAN_INTERFACE_FIELD, OBD_INTERFACE_FIELD));
private static final long serialVersionUID = 1L;
private final String interfaceId;
private final String type;
private final CanInterface canInterface;
private final ObdInterface obdInterface;
private NetworkInterface(BuilderImpl builder) {
this.interfaceId = builder.interfaceId;
this.type = builder.type;
this.canInterface = builder.canInterface;
this.obdInterface = builder.obdInterface;
}
/**
*
* The ID of the network interface.
*
*
* @return The ID of the network interface.
*/
public final String interfaceId() {
return interfaceId;
}
/**
*
* The network protocol for the vehicle. For example, CAN_SIGNAL
specifies a protocol that defines how
* data is communicated between electronic control units (ECUs). OBD_SIGNAL
specifies a protocol that
* defines how self-diagnostic data is communicated between ECUs.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link NetworkInterfaceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The network protocol for the vehicle. For example, CAN_SIGNAL
specifies a protocol that
* defines how data is communicated between electronic control units (ECUs). OBD_SIGNAL
* specifies a protocol that defines how self-diagnostic data is communicated between ECUs.
* @see NetworkInterfaceType
*/
public final NetworkInterfaceType type() {
return NetworkInterfaceType.fromValue(type);
}
/**
*
* The network protocol for the vehicle. For example, CAN_SIGNAL
specifies a protocol that defines how
* data is communicated between electronic control units (ECUs). OBD_SIGNAL
specifies a protocol that
* defines how self-diagnostic data is communicated between ECUs.
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #type} will return
* {@link NetworkInterfaceType#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #typeAsString}.
*
*
* @return The network protocol for the vehicle. For example, CAN_SIGNAL
specifies a protocol that
* defines how data is communicated between electronic control units (ECUs). OBD_SIGNAL
* specifies a protocol that defines how self-diagnostic data is communicated between ECUs.
* @see NetworkInterfaceType
*/
public final String typeAsString() {
return type;
}
/**
*
* Information about a network interface specified by the Controller Area Network (CAN) protocol.
*
*
* @return Information about a network interface specified by the Controller Area Network (CAN) protocol.
*/
public final CanInterface canInterface() {
return canInterface;
}
/**
*
* Information about a network interface specified by the On-board diagnostic (OBD) II protocol.
*
*
* @return Information about a network interface specified by the On-board diagnostic (OBD) II protocol.
*/
public final ObdInterface obdInterface() {
return obdInterface;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(interfaceId());
hashCode = 31 * hashCode + Objects.hashCode(typeAsString());
hashCode = 31 * hashCode + Objects.hashCode(canInterface());
hashCode = 31 * hashCode + Objects.hashCode(obdInterface());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof NetworkInterface)) {
return false;
}
NetworkInterface other = (NetworkInterface) obj;
return Objects.equals(interfaceId(), other.interfaceId()) && Objects.equals(typeAsString(), other.typeAsString())
&& Objects.equals(canInterface(), other.canInterface()) && Objects.equals(obdInterface(), other.obdInterface());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("NetworkInterface").add("InterfaceId", interfaceId()).add("Type", typeAsString())
.add("CanInterface", canInterface()).add("ObdInterface", obdInterface()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "interfaceId":
return Optional.ofNullable(clazz.cast(interfaceId()));
case "type":
return Optional.ofNullable(clazz.cast(typeAsString()));
case "canInterface":
return Optional.ofNullable(clazz.cast(canInterface()));
case "obdInterface":
return Optional.ofNullable(clazz.cast(obdInterface()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function