com.geotab.model.entity.controller.Controller Maven / Gradle / Ivy
/*
*
* 2020 Copyright (C) Geotab Inc. All rights reserved.
*/
package com.geotab.model.entity.controller;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.geotab.model.entity.NameEntityWithVersion;
import com.geotab.model.entity.source.Source;
import com.geotab.model.serialization.ControllerDeserializer;
import lombok.Builder;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**
* The controller that the diagnostic belongs to. Controllers could be ABS controller, suspension
* controller etc.
*/
@NoArgsConstructor
@Getter
@Setter
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@JsonDeserialize(using = ControllerDeserializer.class)
public class Controller extends NameEntityWithVersion {
/**
* Controller diagnostic code (if applicable).
*/
protected Short code;
/**
* The message identification code for the controller of the diagnostic (if applicable).
*/
protected Short codeId;
/**
* The standard (format) of the {@link Source}.
*/
protected Source source;
@Builder
public Controller(String id, String name, Long version, Short code, Short codeId,
Source source) {
super(id, name, version);
this.code = code;
this.codeId = codeId;
this.source = source;
}
/**
* Code is no longer supported an will be removed in a future release. Replace usage with codeId
* property.
*/
@Deprecated
public Short getCode() {
if (code != null && code < 0) {
return 0;
}
return code;
}
}