All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.geotab.model.Id Maven / Gradle / Ivy

/*
 *
 * 2020 Copyright (C) Geotab Inc. All rights reserved.
 */

package com.geotab.model;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.geotab.model.serialization.IdDeserializer;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * Represents an object containing just the id.
 *
 * 

Can be used in a request search to pass an object with id only, or as a class attribute type * in which case an incoming "id" property will get serialized to this class. * *

If serialization of this class is needed as string "id" only, * then annotate the property with {@link com.geotab.model.serialization.IdAsStringSerializer} *

 *   {@code
 *     @JsonSerialize(using = IdAsStringSerializer.class)
 *     private Id id;
 *    }
 * 
*/ @AllArgsConstructor @NoArgsConstructor @Data @Builder @JsonDeserialize(using = IdDeserializer.class) public class Id implements Comparable { private String id; @Override public int compareTo(Id other) { if (this.getId() == null && other.getId() == null) { return 0; } else if (this.getId() == null) { return -1; } else if (other.getId() == null) { return 1; } else { return this.getId().compareTo(other.getId()); } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy