001/* 002 * Copyright 2018 The Billing Project, LLC 003 * 004 * The Billing Project licenses this file to you under the Apache License, version 2.0 005 * (the "License"); you may not use this file except in compliance with the 006 * License. You may obtain a copy of the License at: 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 013 * License for the specific language governing permissions and limitations 014 * under the License. 015 */ 016 017package com.ning.billing.recurly.model; 018 019import com.fasterxml.jackson.core.JsonGenerationException; 020import com.fasterxml.jackson.core.JsonGenerator; 021import com.fasterxml.jackson.databind.SerializerProvider; 022import com.fasterxml.jackson.databind.ser.std.StdSerializer; 023 024import java.io.IOException; 025 026public class PlanCodeSerializer extends StdSerializer<PlanCode> { 027 028 public PlanCodeSerializer() { 029 this(null); 030 } 031 032 public PlanCodeSerializer(final Class<PlanCode> t) { 033 super(t); 034 } 035 036 @Override 037 public void serialize(final PlanCode value, final JsonGenerator jgen, final SerializerProvider provider) throws IOException, JsonGenerationException { 038 jgen.writeObject(value.getName()); 039 } 040}