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

com.github.fge.avro.translators.LongTranslator Maven / Gradle / Ivy

There is a newer version: 0.8.2
Show newest version
package com.github.fge.avro.translators;

import com.github.fge.avro.MutableTree;
import com.github.fge.jsonschema.exceptions.ProcessingException;
import com.github.fge.jsonschema.report.ProcessingReport;
import com.github.fge.jsonschema.util.NodeType;
import org.apache.avro.Schema;

final class LongTranslator
    extends AvroTranslator
{
    private static final AvroTranslator INSTANCE = new LongTranslator();

    private LongTranslator()
    {
    }

    static AvroTranslator getInstance()
    {
        return INSTANCE;
    }

    @Override
    public void translate(final Schema avroSchema, final MutableTree jsonSchema,
        final ProcessingReport report)
        throws ProcessingException
    {
        jsonSchema.setType(NodeType.INTEGER);
        jsonSchema.getCurrentNode().put("minimum", Long.MIN_VALUE)
            .put("maximum", Long.MAX_VALUE);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy