// Path: acpg-lib/src/main/java/org/jraf/acpg/lib/GeneratorException.java
// public class GeneratorException extends Exception {
//     public GeneratorException(String message) {
//         super(message);
//     }
// 
//     public GeneratorException(String message, Throwable cause) {
//         super(message, cause);
//     }
// }


import org.apache.commons.lang.WordUtils;
import org.jraf.acpg.lib.GeneratorException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
    public void addField(Field field) {
        mFields.add(field);
    }

    public void addField(int index, Field field) {
        mFields.add(index, field);
    }

    public List<Field> getFields() {
        return Collections.unmodifiableList(mFields);
    }

    public List<Field> getFieldsIncludingJoins() throws GeneratorException {
        return getFieldsIncludingJoins(false, "", false);
    }

    private List<Field> getFieldsIncludingJoins(boolean isForeign, String path, boolean forceNullable) throws GeneratorException {
        List<Field> res = new ArrayList<>();
        for (Field field : mFields) {
            if (field.getIsId() && isForeign) continue;

            if (isForeign) {
                res.add(field.asForeignField(path, forceNullable));
            } else {
                res.add(field);
            }

            ForeignKey foreignKey = field.getForeignKey();
            if (foreignKey == null) continue;

// Path: acpg-lib/src/main/java/org/jraf/acpg/lib/GeneratorException.java
// public class GeneratorException extends Exception {
//     public GeneratorException(String message) {
//         super(message);
//     }
// 
//     public GeneratorException(String message, Throwable cause) {
//         super(message, cause);
//     }
// }


// Path: acpg-lib/src/main/java/org/jraf/acpg/lib/model/Entity.java
import org.apache.commons.lang.WordUtils;
import org.jraf.acpg.lib.GeneratorException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;

    public void addField(Field field) {
        mFields.add(field);
    }

    public void addField(int index, Field field) {
        mFields.add(index, field);
    }

    public List<Field> getFields() {
        return Collections.unmodifiableList(mFields);
    }

    public List<Field> getFieldsIncludingJoins() throws GeneratorException {
        return getFieldsIncludingJoins(false, "", false);
    }

    private List<Field> getFieldsIncludingJoins(boolean isForeign, String path, boolean forceNullable) throws GeneratorException {
        List<Field> res = new ArrayList<>();
        for (Field field : mFields) {
            if (field.getIsId() && isForeign) continue;

            if (isForeign) {
                res.add(field.asForeignField(path, forceNullable));
            } else {
                res.add(field);
            }

            ForeignKey foreignKey = field.getForeignKey();
            if (foreignKey == null) continue;

            String newPath = path + foreignKey.getEntity().getNameCamelCase();