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

com.at.avro.formatters.DateFormatter Maven / Gradle / Ivy

The newest version!
package com.at.avro.formatters;

import com.at.avro.config.FormatterConfig;
import com.at.avro.types.Date;

/**
 * @author [email protected]
 */
public class DateFormatter implements Formatter {

    @Override
    public String toJson(Date date, FormatterConfig config) {
        String template = "{ \"type\":\"%s\", \"logicalType\":\"%s\", \"java-class\":\"%s\" }".replaceAll(":", config.colon());
        return String.format(template, date.getPrimitiveType(), date.getLogicalType(), date.getJavaClass());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy