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

com.geotab.model.serialization.UserAsStringSerializer Maven / Gradle / Ivy

package com.geotab.model.serialization;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import com.geotab.model.entity.user.User;
import java.io.IOException;

public class UserAsStringSerializer extends JsonSerializer {

  @Override
  public void serialize(User user, JsonGenerator jsonGenerator,
      SerializerProvider serializerProvider) throws IOException {
    if (user.isSystemEntity()) {
      jsonGenerator.writeString(user.getId().getId());
    } else {
      jsonGenerator.writeObject(user.getId());
    }

  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy