GeometryAsWKTSerializer.java

/*******************************************************************************
 * Copyright (c) 2015 VoyagerSearch and others
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Apache License, Version 2.0 which
 * accompanies this distribution and is available at
 *    http://www.apache.org/licenses/LICENSE-2.0.txt
 ******************************************************************************/

package org.locationtech.spatial4j.io.jackson;

import java.io.IOException;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.locationtech.jts.geom.Geometry;

public class GeometryAsWKTSerializer extends JsonSerializer<Geometry>
{
  @Override
  public void serialize(Geometry value, JsonGenerator gen,
      SerializerProvider serializers) throws IOException,
      JsonProcessingException {
    
    gen.writeString(value.toText());
  }
}