in tools/code-generation/generator/src/main/java/com/amazonaws/util/awsclientgenerator/generators/cpp/JsonCppClientGenerator.java [47:89]
protected SdkFileEntry generateModelHeaderFile(ServiceModel serviceModel, Map.Entry<String, Shape> shapeEntry) throws Exception {
Shape shape = shapeEntry.getValue();
if (shape.isException() && !shape.isJsonModeledException())
return null;
if (shape.isResult() && shape.hasEventStreamMembers())
return null;
if (shape.isDocument())
return null;
//we only want to override json related stuff.
if (shape.isRequest() || shape.isEnum() || shape.hasEventPayloadMembers() && shape.hasBlobMembers()) {
return super.generateModelHeaderFile(serviceModel, shapeEntry);
}
if (shape.isStructure() && shape.isReferenced()) {
Template template = null;
VelocityContext context = createContext(serviceModel);
if (shape.isResult()) {
if (shape.hasStreamMembers()) {
template = velocityEngine.getTemplate("/com/amazonaws/util/awsclientgenerator/velocity/cpp/StreamResultHeader.vm", StandardCharsets.UTF_8.name());
} else {
template = velocityEngine.getTemplate("/com/amazonaws/util/awsclientgenerator/velocity/cpp/json/JsonResultHeader.vm", StandardCharsets.UTF_8.name());
}
} else if (shape.isEventStream() && shape.isOutgoingEventStream()) {
template = velocityEngine.getTemplate("/com/amazonaws/util/awsclientgenerator/velocity/cpp/json/EventStreamHeader.vm", StandardCharsets.UTF_8.name());
} else if (shape.isStructure()) {
template = velocityEngine.getTemplate("/com/amazonaws/util/awsclientgenerator/velocity/cpp/json/JsonSubObjectHeader.vm", StandardCharsets.UTF_8.name());
}
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;
}