org.fasterxml.jackson.tc.TestEnumSerializer.java Source code

Java tutorial

Introduction

Here is the source code for org.fasterxml.jackson.tc.TestEnumSerializer.java

Source

/******************************************************************************
 ** This data and information is proprietary to, and a valuable trade secret
 ** of, Basis Technology Corp.  It is given in confidence by Basis Technology
 ** and may only be used as permitted under the license agreement under which
 ** it has been distributed, and in no other way.
 **
 ** Copyright (c) 2014 Basis Technology Corporation All rights reserved.
 **
 ** The technical data and information provided herein are provided with
 ** `limited rights', and the computer software provided herein is provided
 ** with `restricted rights' as those terms are defined in DAR and ASPR
 ** 7-104.9(a).
 ******************************************************************************/

package org.fasterxml.jackson.tc;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;

/**
 * Jackson serializer for LanguageCode.
 */
public class TestEnumSerializer extends JsonSerializer<TestEnum> {
    @Override
    public void serialize(TestEnum languageCode, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
            throws IOException {
        jsonGenerator.writeString(languageCode.code());
    }

    @Override
    public Class<TestEnum> handledType() {
        return TestEnum.class;
    }
}