// Path: src/main/java/com/mysema/codegen/Symbols.java
// public static final String ASSIGN = " = ";
// 
// Path: src/main/java/com/mysema/codegen/Symbols.java
// public static final String COMMA = ", ";
// 
// Path: src/main/java/com/mysema/codegen/Symbols.java
// public static final String DOT = ".";
// 
// Path: src/main/java/com/mysema/codegen/Symbols.java
// public static final String QUOTE = "\"";
// 
// Path: src/main/java/com/mysema/codegen/Symbols.java
// public static final String SEMICOLON = ";";
// 
// Path: src/main/java/com/mysema/codegen/Symbols.java
// public static final String SPACE = " ";
// 
// Path: src/main/java/com/mysema/codegen/model/Parameter.java
// public final class Parameter {
// 
//     private final String name;
// 
//     private final Type type;
// 
//     public Parameter(String name, Type type) {
//         this.name = name;
//         this.type = type;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (o == this) {
//             return true;
//         } else if (o instanceof Parameter) {
//             Parameter t = (Parameter) o;
//             return type.equals(t.type) && name.equals(t.name);
//         } else {
//             return false;
//         }
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public Type getType() {
//         return type;
//     }
// 
//     @Override
//     public int hashCode() {
//         return type.hashCode();
//     }
// 
//     @Override
//     public String toString() {
//         return type + " " + name;
//     }
// }
// 
// Path: src/main/java/com/mysema/codegen/model/Type.java
// public interface Type {
// 
//     Type as(TypeCategory category);
// 
//     Type asArrayType();
// 
//     Type getComponentType();
// 
//     Type getEnclosingType();
// 
//     TypeCategory getCategory();
// 
//     String getFullName();
// 
//     String getGenericName(boolean asArgType);
// 
//     String getGenericName(boolean asArgType, Set<String> packages, Set<String> classes);
// 
//     Class<?> getJavaClass();
// 
//     String getPackageName();
// 
//     List<Type> getParameters();
// 
//     String getRawName(Set<String> packages, Set<String> classes);
// 
//     String getSimpleName();
// 
//     boolean isFinal();
// 
//     boolean isPrimitive();
// 
//     boolean isMember();
// 
// }


import com.google.common.base.Function;
import com.mysema.codegen.model.Parameter;
import com.mysema.codegen.model.Type;
import static com.mysema.codegen.Symbols.ASSIGN;
import static com.mysema.codegen.Symbols.COMMA;
import static com.mysema.codegen.Symbols.DOT;
import static com.mysema.codegen.Symbols.QUOTE;
import static com.mysema.codegen.Symbols.SEMICOLON;
import static com.mysema.codegen.Symbols.SPACE;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.Stack;

/*
 * Copyright 2010, Mysema Ltd
 * 
 * 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 com.mysema.codegen;




/**
 * JavaWriter is the default implementation of the CodeWriter interface
 * 
 * @author tiwe
 * 
 */
public final class JavaWriter extends AbstractCodeWriter<JavaWriter> {

    private static final String EXTENDS = " extends ";

    private static final String IMPLEMENTS = " implements ";

    private static final String IMPORT = "import ";

    private static final String IMPORT_STATIC = "import static ";

    private static final String PACKAGE = "package ";

    private static final String PRIVATE = "private ";

    private static final String PRIVATE_FINAL = "private final ";

    private static final String PRIVATE_STATIC_FINAL = "private static final ";

    private static final String PROTECTED = "protected ";

    private static final String PROTECTED_FINAL = "protected final ";

    private static final String PUBLIC = "public ";

    private static final String PUBLIC_CLASS = "public class ";

    private static final String PUBLIC_FINAL = "public final ";

    private static final String PUBLIC_INTERFACE = "public interface ";

    private static final String PUBLIC_STATIC = "public static ";

    private static final String PUBLIC_STATIC_FINAL = "public static final ";

    private final Set<String> classes = new HashSet<String>();

    private final Set<String> packages = new HashSet<String>();


// Path: src/main/java/com/mysema/codegen/Symbols.java
// public static final String ASSIGN = " = ";
// 
// Path: src/main/java/com/mysema/codegen/Symbols.java
// public static final String COMMA = ", ";
// 
// Path: src/main/java/com/mysema/codegen/Symbols.java
// public static final String DOT = ".";
// 
// Path: src/main/java/com/mysema/codegen/Symbols.java
// public static final String QUOTE = "\"";
// 
// Path: src/main/java/com/mysema/codegen/Symbols.java
// public static final String SEMICOLON = ";";
// 
// Path: src/main/java/com/mysema/codegen/Symbols.java
// public static final String SPACE = " ";
// 
// Path: src/main/java/com/mysema/codegen/model/Parameter.java
// public final class Parameter {
// 
//     private final String name;
// 
//     private final Type type;
// 
//     public Parameter(String name, Type type) {
//         this.name = name;
//         this.type = type;
//     }
// 
//     @Override
//     public boolean equals(Object o) {
//         if (o == this) {
//             return true;
//         } else if (o instanceof Parameter) {
//             Parameter t = (Parameter) o;
//             return type.equals(t.type) && name.equals(t.name);
//         } else {
//             return false;
//         }
//     }
// 
//     public String getName() {
//         return name;
//     }
// 
//     public Type getType() {
//         return type;
//     }
// 
//     @Override
//     public int hashCode() {
//         return type.hashCode();
//     }
// 
//     @Override
//     public String toString() {
//         return type + " " + name;
//     }
// }
// 
// Path: src/main/java/com/mysema/codegen/model/Type.java
// public interface Type {
// 
//     Type as(TypeCategory category);
// 
//     Type asArrayType();
// 
//     Type getComponentType();
// 
//     Type getEnclosingType();
// 
//     TypeCategory getCategory();
// 
//     String getFullName();
// 
//     String getGenericName(boolean asArgType);
// 
//     String getGenericName(boolean asArgType, Set<String> packages, Set<String> classes);
// 
//     Class<?> getJavaClass();
// 
//     String getPackageName();
// 
//     List<Type> getParameters();
// 
//     String getRawName(Set<String> packages, Set<String> classes);
// 
//     String getSimpleName();
// 
//     boolean isFinal();
// 
//     boolean isPrimitive();
// 
//     boolean isMember();
// 
// }


// Path: src/main/java/com/mysema/codegen/JavaWriter.java
import com.google.common.base.Function;
import com.mysema.codegen.model.Parameter;
import com.mysema.codegen.model.Type;
import static com.mysema.codegen.Symbols.ASSIGN;
import static com.mysema.codegen.Symbols.COMMA;
import static com.mysema.codegen.Symbols.DOT;
import static com.mysema.codegen.Symbols.QUOTE;
import static com.mysema.codegen.Symbols.SEMICOLON;
import static com.mysema.codegen.Symbols.SPACE;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.Stack;

/*
 * Copyright 2010, Mysema Ltd
 * 
 * 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 com.mysema.codegen;




/**
 * JavaWriter is the default implementation of the CodeWriter interface
 * 
 * @author tiwe
 * 
 */
public final class JavaWriter extends AbstractCodeWriter<JavaWriter> {

    private static final String EXTENDS = " extends ";

    private static final String IMPLEMENTS = " implements ";

    private static final String IMPORT = "import ";

    private static final String IMPORT_STATIC = "import static ";

    private static final String PACKAGE = "package ";

    private static final String PRIVATE = "private ";

    private static final String PRIVATE_FINAL = "private final ";

    private static final String PRIVATE_STATIC_FINAL = "private static final ";

    private static final String PROTECTED = "protected ";

    private static final String PROTECTED_FINAL = "protected final ";

    private static final String PUBLIC = "public ";

    private static final String PUBLIC_CLASS = "public class ";

    private static final String PUBLIC_FINAL = "public final ";

    private static final String PUBLIC_INTERFACE = "public interface ";

    private static final String PUBLIC_STATIC = "public static ";

    private static final String PUBLIC_STATIC_FINAL = "public static final ";

    private final Set<String> classes = new HashSet<String>();

    private final Set<String> packages = new HashSet<String>();


    private final Stack<Type> types = new Stack<Type>();
