// Path: src/main/java/com/greensopinion/swagger/jaxrsgen/SafeExecutor.java
// public class SafeExecutor {
// 
// 	public interface RunnableWithCheckedException {
// 
// 		public void run() throws Exception;
// 	}
// 
// 	public static void run(RunnableWithCheckedException runnable) {
// 		try {
// 			runnable.run();
// 		} catch (Exception e) {
// 			propagateAsUncheckedException(e);
// 		}
// 	}
// 
// 	public static <T> T call(Callable<T> callable) {
// 		try {
// 			return callable.call();
// 		} catch (Exception e) {
// 			throw propagateAsUncheckedException(e);
// 		}
// 	}
// 
// 	private static RuntimeException propagateAsUncheckedException(Exception e) {
// 		if (e instanceof RuntimeException) {
// 			throw (RuntimeException) e;
// 		}
// 		throw new RuntimeException(e);
// 	}
// }
// 
// Path: src/main/java/com/greensopinion/swagger/jaxrsgen/model/ApiModel.java
// public static class Property {
// 
// 	private final String type;
// 
// 	private final String format;
// 
// 	@SerializedName("items")
// 	private final Map<String, String> arrayItems;
// 
// 	private final String description;
// 
// 	@SerializedName("enum")
// 	private final List<String> enumeratedValues;
// 
// 	public Property(String type, String format, String description, List<String> enumeratedValues,
// 			Map<String, String> arrayItems) {
// 		this.type = type;
// 		this.format = format;
// 		this.description = Strings.emptyToNull(description);
// 		this.arrayItems = arrayItems == null ? null : ImmutableMap.copyOf(arrayItems);
// 		this.enumeratedValues = enumeratedValues == null ? null : ImmutableList.copyOf(enumeratedValues);
// 	}
// 
// 	public String getType() {
// 		return type;
// 	}
// 
// 	public String getFormat() {
// 		return format;
// 	}
// 
// 	public String getDescription() {
// 		return description;
// 	}
// 
// 	public List<String> getEnumeratedValues() {
// 		return enumeratedValues;
// 	}
// 
// }


import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.FieldNamingStrategy;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.greensopinion.swagger.jaxrsgen.SafeExecutor;
import com.greensopinion.swagger.jaxrsgen.model.ApiModel.Property;
import io.swagger.annotations.ApiModelProperty;
/*******************************************************************************
 * Copyright (c) 2014, 2015 Tasktop Technologies.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Tasktop EULA
 * which accompanies this distribution, and is available at
 * http://tasktop.com/legal
 *******************************************************************************/

package com.greensopinion.swagger.jaxrsgen.model;




public class GsonIntrospector extends JsonIntrospector {

	private final FieldNamingStrategy fieldNamingStrategy = FieldNamingPolicy.IDENTITY;

	@Override
	public Set<Class<?>> fieldModelClasses(Class<?> modelClass) {
		Set<Class<?>> classes = Sets.newHashSet();
		fieldModelClasses(classes, modelClass);
		return classes;
	}

	private void fieldModelClasses(Set<Class<?>> classes, Class<?> modelClass) {
		for (Field field : modelFields(modelClass)) {
			Class<?> fieldType = ApiTypes.modelClass(field.getGenericType());
			if (ApiTypes.isModelClass(fieldType)) {
				if (classes.add(fieldType)) {
					fieldModelClasses(classes, fieldType);
				}
			}
		}
	}

	@Override
	public ApiModel createApiModel(Class<?> modelClass) {
		String name = ApiTypes.calculateTypeName(modelClass);
		String description = calculateDescription(modelClass);
		LinkedHashMap<String, Property> properties = Maps.newLinkedHashMap();
		List<String> required = Lists.newArrayList();

		for (Field f : modelFields(modelClass)) {
// Path: src/main/java/com/greensopinion/swagger/jaxrsgen/SafeExecutor.java
// public class SafeExecutor {
// 
// 	public interface RunnableWithCheckedException {
// 
// 		public void run() throws Exception;
// 	}
// 
// 	public static void run(RunnableWithCheckedException runnable) {
// 		try {
// 			runnable.run();
// 		} catch (Exception e) {
// 			propagateAsUncheckedException(e);
// 		}
// 	}
// 
// 	public static <T> T call(Callable<T> callable) {
// 		try {
// 			return callable.call();
// 		} catch (Exception e) {
// 			throw propagateAsUncheckedException(e);
// 		}
// 	}
// 
// 	private static RuntimeException propagateAsUncheckedException(Exception e) {
// 		if (e instanceof RuntimeException) {
// 			throw (RuntimeException) e;
// 		}
// 		throw new RuntimeException(e);
// 	}
// }
// 
// Path: src/main/java/com/greensopinion/swagger/jaxrsgen/model/ApiModel.java
// public static class Property {
// 
// 	private final String type;
// 
// 	private final String format;
// 
// 	@SerializedName("items")
// 	private final Map<String, String> arrayItems;
// 
// 	private final String description;
// 
// 	@SerializedName("enum")
// 	private final List<String> enumeratedValues;
// 
// 	public Property(String type, String format, String description, List<String> enumeratedValues,
// 			Map<String, String> arrayItems) {
// 		this.type = type;
// 		this.format = format;
// 		this.description = Strings.emptyToNull(description);
// 		this.arrayItems = arrayItems == null ? null : ImmutableMap.copyOf(arrayItems);
// 		this.enumeratedValues = enumeratedValues == null ? null : ImmutableList.copyOf(enumeratedValues);
// 	}
// 
// 	public String getType() {
// 		return type;
// 	}
// 
// 	public String getFormat() {
// 		return format;
// 	}
// 
// 	public String getDescription() {
// 		return description;
// 	}
// 
// 	public List<String> getEnumeratedValues() {
// 		return enumeratedValues;
// 	}
// 
// }


// Path: src/main/java/com/greensopinion/swagger/jaxrsgen/model/GsonIntrospector.java
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.FieldNamingStrategy;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.greensopinion.swagger.jaxrsgen.SafeExecutor;
import com.greensopinion.swagger.jaxrsgen.model.ApiModel.Property;
import io.swagger.annotations.ApiModelProperty;

/*******************************************************************************
 * Copyright (c) 2014, 2015 Tasktop Technologies.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Tasktop EULA
 * which accompanies this distribution, and is available at
 * http://tasktop.com/legal
 *******************************************************************************/

package com.greensopinion.swagger.jaxrsgen.model;




public class GsonIntrospector extends JsonIntrospector {

	private final FieldNamingStrategy fieldNamingStrategy = FieldNamingPolicy.IDENTITY;

	@Override
	public Set<Class<?>> fieldModelClasses(Class<?> modelClass) {
		Set<Class<?>> classes = Sets.newHashSet();
		fieldModelClasses(classes, modelClass);
		return classes;
	}

	private void fieldModelClasses(Set<Class<?>> classes, Class<?> modelClass) {
		for (Field field : modelFields(modelClass)) {
			Class<?> fieldType = ApiTypes.modelClass(field.getGenericType());
			if (ApiTypes.isModelClass(fieldType)) {
				if (classes.add(fieldType)) {
					fieldModelClasses(classes, fieldType);
				}
			}
		}
	}

	@Override
	public ApiModel createApiModel(Class<?> modelClass) {
		String name = ApiTypes.calculateTypeName(modelClass);
		String description = calculateDescription(modelClass);
		LinkedHashMap<String, Property> properties = Maps.newLinkedHashMap();
		List<String> required = Lists.newArrayList();

		for (Field f : modelFields(modelClass)) {
			Property property = createApiModelProperty(f);