// Path: java2typescript-jackson/src/main/java/java2typescript/jackson/module/grammar/base/AbstractNamedType.java
// abstract public class AbstractNamedType extends AbstractType {
// 
// 	protected final String name;
// 
// 	public AbstractNamedType(String className) {
// 		this.name = className;
// 	}
// 
// 	@Override
// 	public void write(Writer writer) throws IOException {
// 		writer.write(name);
// 	}
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public void writeDef(Writer writer, WriterPreferences preferences) throws IOException {
// 		if(!preferences.hasCustomWriter(this)) {
// 			writeDefInternal(writer, preferences);
// 		} else {
// 			preferences.writeDef(this, writer);
// 		}
// 	}
// 
// 	abstract public void writeDefInternal(Writer writer, WriterPreferences preferences) throws IOException;
// }
// 
// Path: java2typescript-jackson/src/main/java/java2typescript/jackson/module/writer/WriterPreferences.java
// public class WriterPreferences {
// 	private String indentationStep = "    ";
// 	private int indentationLevel = 0;
// 
// 	private List<CustomAbstractTypeWriter> customWriters = new ArrayList<CustomAbstractTypeWriter>();
// 	private boolean useEnumPattern;
// 	private boolean enumAsStringLiteralType = false;
// 	private boolean constantsForStringLiteralTypeEnums = false;
// 	/** sort types and vars in output */
// 	private boolean sort;
// 
// 	public boolean isStringLiteralTypeForEnums() {
// 		return enumAsStringLiteralType;
// 	}
// 
// 	public void useStringLiteralTypeForEnums(boolean withConstants) {
// 		addWriter(new EnumTypeToStringLiteralTypeWriter());
// 		this.enumAsStringLiteralType = true;
// 		this.constantsForStringLiteralTypeEnums = withConstants;
// 	}
// 
// 	public void useStringLiteralTypeForEnums() {
// 		useStringLiteralTypeForEnums(false);
// 	}
// 
// 	public boolean isConstantsForStringLiteralTypeEnums() {
// 		return this.constantsForStringLiteralTypeEnums;
// 	}
// 	
// 	public void useEnumPattern() {
// 		addWriter(new EnumTypeToEnumPatternWriter());
// 		useEnumPattern = true;
// 	}
// 
// 	public boolean isUseEnumPattern() {
// 		return useEnumPattern;
// 	}
// 	
// 	public void sort() {
// 		sort = true;
// 	}
// 	
// 	public boolean isSort() {
// 		return sort;
// 	}
// 
// 	public void addWriter(CustomAbstractTypeWriter writer) {
// 		this.customWriters.add(writer);
// 	}
// 
// 	public List<CustomAbstractTypeWriter> getCustomWriters() {
// 		return customWriters;
// 	}
// 
// 	public boolean hasCustomWriter(AbstractNamedType type) {
// 		return getCustomWriter(type) != null;
// 	}
// 
// 	public void writeDef(AbstractNamedType type, Writer writer) throws IOException {
// 		getCustomWriter(type).writeDef(type, writer, this);
// 	}
// 
// 	public CustomAbstractTypeWriter getCustomWriter(AbstractNamedType type) {
// 		for (CustomAbstractTypeWriter writer : customWriters) {
// 			if (writer.accepts(type, this)) {
// 				return writer;
// 			}
// 		}
// 		return null;
// 	}
// 
// 	public String getIndentation() {
// 		StringBuilder sb = new StringBuilder();
// 		int i = 0;
// 		while (i++ < indentationLevel) {
// 			sb.append(indentationStep);
// 		}
// 		return sb.toString();
// 	}
// 
// 	public void setIndentationStep(String indentation) {
// 		this.indentationStep = indentation;
// 	}
// 
// 	public void increaseIndentation() {
// 		indentationLevel++;
// 	}
// 
// 	public void decreaseIndention() {
// 		indentationLevel--;
// 	}
// 
// }


import java2typescript.jackson.module.writer.SortUtil;
import java2typescript.jackson.module.writer.WriterPreferences;
import static java.lang.String.format;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java2typescript.jackson.module.grammar.base.AbstractNamedType;
import java2typescript.jackson.module.grammar.base.AbstractType;
/*******************************************************************************
 * Copyright 2013 Raphael Jolivet
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package java2typescript.jackson.module.grammar;




public class ClassType extends AbstractNamedType {

	private Map<String, AbstractType> fields = new LinkedHashMap<String, AbstractType>();

	private Map<String, FunctionType> methods = new LinkedHashMap<String, FunctionType>();

	static private ClassType objectType = new ClassType("Object");

	/** Root Object class */
	static public ClassType getObjectClass() {
		return objectType;
	}

	public ClassType(String className) {
		super(className);
	}

	@Override
// Path: java2typescript-jackson/src/main/java/java2typescript/jackson/module/grammar/base/AbstractNamedType.java
// abstract public class AbstractNamedType extends AbstractType {
// 
// 	protected final String name;
// 
// 	public AbstractNamedType(String className) {
// 		this.name = className;
// 	}
// 
// 	@Override
// 	public void write(Writer writer) throws IOException {
// 		writer.write(name);
// 	}
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public void writeDef(Writer writer, WriterPreferences preferences) throws IOException {
// 		if(!preferences.hasCustomWriter(this)) {
// 			writeDefInternal(writer, preferences);
// 		} else {
// 			preferences.writeDef(this, writer);
// 		}
// 	}
// 
// 	abstract public void writeDefInternal(Writer writer, WriterPreferences preferences) throws IOException;
// }
// 
// Path: java2typescript-jackson/src/main/java/java2typescript/jackson/module/writer/WriterPreferences.java
// public class WriterPreferences {
// 	private String indentationStep = "    ";
// 	private int indentationLevel = 0;
// 
// 	private List<CustomAbstractTypeWriter> customWriters = new ArrayList<CustomAbstractTypeWriter>();
// 	private boolean useEnumPattern;
// 	private boolean enumAsStringLiteralType = false;
// 	private boolean constantsForStringLiteralTypeEnums = false;
// 	/** sort types and vars in output */
// 	private boolean sort;
// 
// 	public boolean isStringLiteralTypeForEnums() {
// 		return enumAsStringLiteralType;
// 	}
// 
// 	public void useStringLiteralTypeForEnums(boolean withConstants) {
// 		addWriter(new EnumTypeToStringLiteralTypeWriter());
// 		this.enumAsStringLiteralType = true;
// 		this.constantsForStringLiteralTypeEnums = withConstants;
// 	}
// 
// 	public void useStringLiteralTypeForEnums() {
// 		useStringLiteralTypeForEnums(false);
// 	}
// 
// 	public boolean isConstantsForStringLiteralTypeEnums() {
// 		return this.constantsForStringLiteralTypeEnums;
// 	}
// 	
// 	public void useEnumPattern() {
// 		addWriter(new EnumTypeToEnumPatternWriter());
// 		useEnumPattern = true;
// 	}
// 
// 	public boolean isUseEnumPattern() {
// 		return useEnumPattern;
// 	}
// 	
// 	public void sort() {
// 		sort = true;
// 	}
// 	
// 	public boolean isSort() {
// 		return sort;
// 	}
// 
// 	public void addWriter(CustomAbstractTypeWriter writer) {
// 		this.customWriters.add(writer);
// 	}
// 
// 	public List<CustomAbstractTypeWriter> getCustomWriters() {
// 		return customWriters;
// 	}
// 
// 	public boolean hasCustomWriter(AbstractNamedType type) {
// 		return getCustomWriter(type) != null;
// 	}
// 
// 	public void writeDef(AbstractNamedType type, Writer writer) throws IOException {
// 		getCustomWriter(type).writeDef(type, writer, this);
// 	}
// 
// 	public CustomAbstractTypeWriter getCustomWriter(AbstractNamedType type) {
// 		for (CustomAbstractTypeWriter writer : customWriters) {
// 			if (writer.accepts(type, this)) {
// 				return writer;
// 			}
// 		}
// 		return null;
// 	}
// 
// 	public String getIndentation() {
// 		StringBuilder sb = new StringBuilder();
// 		int i = 0;
// 		while (i++ < indentationLevel) {
// 			sb.append(indentationStep);
// 		}
// 		return sb.toString();
// 	}
// 
// 	public void setIndentationStep(String indentation) {
// 		this.indentationStep = indentation;
// 	}
// 
// 	public void increaseIndentation() {
// 		indentationLevel++;
// 	}
// 
// 	public void decreaseIndention() {
// 		indentationLevel--;
// 	}
// 
// }


// Path: java2typescript-jackson/src/main/java/java2typescript/jackson/module/grammar/ClassType.java
import java2typescript.jackson.module.writer.SortUtil;
import java2typescript.jackson.module.writer.WriterPreferences;
import static java.lang.String.format;
import java.io.IOException;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java2typescript.jackson.module.grammar.base.AbstractNamedType;
import java2typescript.jackson.module.grammar.base.AbstractType;

/*******************************************************************************
 * Copyright 2013 Raphael Jolivet
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *   http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 ******************************************************************************/
package java2typescript.jackson.module.grammar;




public class ClassType extends AbstractNamedType {

	private Map<String, AbstractType> fields = new LinkedHashMap<String, AbstractType>();

	private Map<String, FunctionType> methods = new LinkedHashMap<String, FunctionType>();

	static private ClassType objectType = new ClassType("Object");

	/** Root Object class */
	static public ClassType getObjectClass() {
		return objectType;
	}

	public ClassType(String className) {
		super(className);
	}

	@Override
	public void writeDefInternal(Writer writer, WriterPreferences preferences) throws IOException {