// Path: src/main/java/pl/maciejwalkowiak/plist/PlistSerializer.java
// public interface PlistSerializer {
// 	static final String HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"><plist version=\"1.0\">";
// 	static final String FOOTER = "</plist>";
// 
// 	/**
// 	 * Serializes object to plist and creates valid XML by wrapping it around XML header,
// 	 * plist DOCTYPE and &lt;plist&gt; XML tag.
// 	 *
// 	 * @param objectToConvert object to serialize
// 	 * @return a String containing valid XML
// 	 */
// 	String toXmlPlist(Object objectToConvert);
// 
// 	/**
// 	 * Serializes object into plist XML
// 	 *
// 	 * @param objectToConvert object to serialize
// 	 * @return a String containing XML representation without XML header, DOCTYPE
// 	 */
// 	String serialize(Object objectToConvert);
// }
// 
// Path: src/main/java/pl/maciejwalkowiak/plist/PlistSerializerImpl.java
// public class PlistSerializerImpl implements PlistSerializer {
// 	private static final Logger logger = LoggerFactory.getLogger(PlistSerializerImpl.class);
// 
// 	private HandlerWrapper handlerWrapper;
// 	private BasicObjectSerializer basicObjectSerializer;
// 	private FieldSerializer fieldSerializer;
// 	private NamingStrategy namingStrategy = new DefaultNamingStrategy();
// 
// 	public PlistSerializerImpl(NamingStrategy namingStrategy) {
// 		this();
// 		this.namingStrategy = namingStrategy;
// 	}
// 
// 	public PlistSerializerImpl() {
// 		this.handlerWrapper = new HandlerWrapper(this);
// 		this.fieldSerializer = new FieldSerializer(handlerWrapper, this);
// 		this.basicObjectSerializer = new BasicObjectSerializer(handlerWrapper);
// 	}
// 
// 	public String toXmlPlist(Object objectToConvert) {
// 		StringBuilder result = new StringBuilder(HEADER);
// 
// 		result.append(serialize(objectToConvert));
// 
// 		result.append(FOOTER);
// 
// 		return result.toString();
// 	}
// 
// 	public String serialize(Object objectToConvert) {
// 		StringBuilder result = new StringBuilder();
// 
// 		logger.debug("converting object = {}", objectToConvert);
// 
// 		if (objectToConvert != null) {
// 			if (handlerWrapper.isSupported(objectToConvert)) {
// 				result.append(basicObjectSerializer.serializeBasicObject(objectToConvert));
// 			} else {
// 				result.append(fieldSerializer.serializeFields(objectToConvert));
// 			}
// 		}
// 
// 		return result.toString();
// 	}
// 
// 	public void setAdditionalHandlers(List<Handler> additionalHandlers) {
// 		handlerWrapper.addAdditionalHandlers(additionalHandlers);
// 	}
// 
// 	public NamingStrategy getNamingStrategy() {
// 		return namingStrategy;
// 	}
// 
// 	HandlerWrapper getHandlerWrapper() {
// 		return handlerWrapper;
// 	}
// }


import pl.maciejwalkowiak.plist.PlistSerializerImpl;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.HttpOutputMessage;
import org.springframework.http.MediaType;
import org.springframework.http.converter.AbstractHttpMessageConverter;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.http.converter.HttpMessageNotWritableException;
import pl.maciejwalkowiak.plist.PlistSerializer;
/*
 * Copyright (c) 2014 Maciej Walkowiak
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package pl.maciejwalkowiak.plist.spring;



public class PlistHttpMessageConverter extends AbstractHttpMessageConverter<Object> {

	public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");

// Path: src/main/java/pl/maciejwalkowiak/plist/PlistSerializer.java
// public interface PlistSerializer {
// 	static final String HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"><plist version=\"1.0\">";
// 	static final String FOOTER = "</plist>";
// 
// 	/**
// 	 * Serializes object to plist and creates valid XML by wrapping it around XML header,
// 	 * plist DOCTYPE and &lt;plist&gt; XML tag.
// 	 *
// 	 * @param objectToConvert object to serialize
// 	 * @return a String containing valid XML
// 	 */
// 	String toXmlPlist(Object objectToConvert);
// 
// 	/**
// 	 * Serializes object into plist XML
// 	 *
// 	 * @param objectToConvert object to serialize
// 	 * @return a String containing XML representation without XML header, DOCTYPE
// 	 */
// 	String serialize(Object objectToConvert);
// }
// 
// Path: src/main/java/pl/maciejwalkowiak/plist/PlistSerializerImpl.java
// public class PlistSerializerImpl implements PlistSerializer {
// 	private static final Logger logger = LoggerFactory.getLogger(PlistSerializerImpl.class);
// 
// 	private HandlerWrapper handlerWrapper;
// 	private BasicObjectSerializer basicObjectSerializer;
// 	private FieldSerializer fieldSerializer;
// 	private NamingStrategy namingStrategy = new DefaultNamingStrategy();
// 
// 	public PlistSerializerImpl(NamingStrategy namingStrategy) {
// 		this();
// 		this.namingStrategy = namingStrategy;
// 	}
// 
// 	public PlistSerializerImpl() {
// 		this.handlerWrapper = new HandlerWrapper(this);
// 		this.fieldSerializer = new FieldSerializer(handlerWrapper, this);
// 		this.basicObjectSerializer = new BasicObjectSerializer(handlerWrapper);
// 	}
// 
// 	public String toXmlPlist(Object objectToConvert) {
// 		StringBuilder result = new StringBuilder(HEADER);
// 
// 		result.append(serialize(objectToConvert));
// 
// 		result.append(FOOTER);
// 
// 		return result.toString();
// 	}
// 
// 	public String serialize(Object objectToConvert) {
// 		StringBuilder result = new StringBuilder();
// 
// 		logger.debug("converting object = {}", objectToConvert);
// 
// 		if (objectToConvert != null) {
// 			if (handlerWrapper.isSupported(objectToConvert)) {
// 				result.append(basicObjectSerializer.serializeBasicObject(objectToConvert));
// 			} else {
// 				result.append(fieldSerializer.serializeFields(objectToConvert));
// 			}
// 		}
// 
// 		return result.toString();
// 	}
// 
// 	public void setAdditionalHandlers(List<Handler> additionalHandlers) {
// 		handlerWrapper.addAdditionalHandlers(additionalHandlers);
// 	}
// 
// 	public NamingStrategy getNamingStrategy() {
// 		return namingStrategy;
// 	}
// 
// 	HandlerWrapper getHandlerWrapper() {
// 		return handlerWrapper;
// 	}
// }


// Path: src/main/java/pl/maciejwalkowiak/plist/spring/PlistHttpMessageConverter.java
import pl.maciejwalkowiak.plist.PlistSerializerImpl;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.Charset;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpInputMessage;
import org.springframework.http.HttpOutputMessage;
import org.springframework.http.MediaType;
import org.springframework.http.converter.AbstractHttpMessageConverter;
import org.springframework.http.converter.HttpMessageNotReadableException;
import org.springframework.http.converter.HttpMessageNotWritableException;
import pl.maciejwalkowiak.plist.PlistSerializer;

/*
 * Copyright (c) 2014 Maciej Walkowiak
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package pl.maciejwalkowiak.plist.spring;



public class PlistHttpMessageConverter extends AbstractHttpMessageConverter<Object> {

	public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");

	private PlistSerializer plistSerializer;