private static CodeGenTemplatesConfig loadProtocolTemplatesConfig(IntermediateModel model) {
        // CBOR is a type of JSON Protocol.  Use JSON Protocol for templates
        Protocol templateProtocol = model.getMetadata().getProtocol();
        if (Protocol.CBOR.equals(model.getMetadata().getProtocol())) {
            templateProtocol = Protocol.AWS_JSON;
        }
        CodeGenTemplatesConfig protocolDefaultConfig = CodeGenTemplatesConfig.load(templateProtocol);

        CustomizationConfig customConfig = model.getCustomizationConfig();

        if (customConfig == null || customConfig.getCustomCodeTemplates() == null) {
            return protocolDefaultConfig;
        }

        // merge any custom config and return the result.
        return CodeGenTemplatesConfig.merge(protocolDefaultConfig, customConfig.getCustomCodeTemplates());
    }
Util class that sets up the freemarker configuration and loads the templates.
aws-java-sdk-code-generator/src/main/java/com/amazonaws/codegen/internal/Freemarker.java