protected SdkFileEntry generateModelHeaderFile()

in tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/generators/cpp/RestXmlCppClientGenerator.java [102:141]


    protected SdkFileEntry generateModelHeaderFile(ServiceModel serviceModel, Map.Entry<String, Shape> shapeEntry) throws Exception {

        Shape shape = shapeEntry.getValue();
        if (shape.isException() && !shape.isXmlModeledException())
            return null;

        //we only want to override json related stuff.
        if (shape.isRequest() || shape.isEnum() || shape.hasEventPayloadMembers() && shape.hasBlobMembers()) {
            return super.generateModelHeaderFile(serviceModel, shapeEntry);
        }

        // Will not generate source code if it's a shape of event, with empty member.
        if (shape.isStructure() && shape.isReferenced() &&
            !(shape.isEventStream() ||
                (shape.isEvent() && shape.getMembers().isEmpty() && !shape.getName().endsWith("InitialResponse")) ||
                (shape.isResult() && shape.hasEventStreamMembers()))) {
            Template template = null;
            VelocityContext context = createContext(serviceModel);

            if (shape.isResult() && shape.hasStreamMembers()) {
                template = velocityEngine.getTemplate("/com/amazonaws/util/awsclientgenerator/velocity/cpp/StreamResultHeader.vm", StandardCharsets.UTF_8.name());
            }
            else if (shape.isResult()) {
                template = velocityEngine.getTemplate("/com/amazonaws/util/awsclientgenerator/velocity/cpp/xml/XmlResultHeader.vm", StandardCharsets.UTF_8.name());
            }else if (!shape.isRequest() && shape.isStructure()) {
                template = velocityEngine.getTemplate("/com/amazonaws/util/awsclientgenerator/velocity/cpp/xml/rest/RestXmlSubObjectHeader.vm", StandardCharsets.UTF_8.name());
            }

            if(template == null) return null; //temporary

            context.put("shape", shape);
            context.put("typeInfo", new CppShapeInformation(shape, serviceModel));
            context.put("CppViewHelper", CppViewHelper.class);

            String fileName = String.format("include/aws/%s/model/%s.h", serviceModel.getMetadata().getProjectName(),
                    shapeEntry.getKey());
            return makeFile(template, context, fileName, true);
        }
        return null;
    }