[C++] [Restbed] Reworked Resource class names (#6017)

* - Added Restbed Generator

* - Added Json processing functions to model
- Removed unnused code from restbed codegen class
- Added response header processing to api template

* Changed it to respect alphabetical order

* Made the string joining java 7 compatible

* Added samples

* Started work on restbed improvment

* - Updated samples
- Reworked Resource class names
- Added vendor extension for new formatted resource class names

* fix indention
This commit is contained in:
stkrwork
2017-07-10 18:37:08 +02:00
committed by wing328
parent d522236cec
commit f2f303b2e8
9 changed files with 163 additions and 155 deletions

View File

@@ -234,16 +234,24 @@ public class RestbedCodegen extends AbstractCppCodegen {
String path = new String(op.path);
String[] items = path.split("/", -1);
List<String> splitPath = new ArrayList<String>();
String resourceNameCamelCase = "";
op.path = "";
for (String item: items) {
if (item.matches("^\\{(.*)\\}$")) {
item = item.substring(0, item.length()-1);
item += ": .*}";
}
splitPath.add(item);
if (item.length() > 1) {
if (item.matches("^\\{(.*)\\}$")) {
String tmpResourceName = item.substring(1, item.length()-1);
resourceNameCamelCase += Character.toUpperCase(tmpResourceName.charAt(0)) + tmpResourceName.substring(1);
item = item.substring(0, item.length()-1);
item += ": .*}";
} else {
resourceNameCamelCase += Character.toUpperCase(item.charAt(0)) + item.substring(1);
}
} else if (item.length() == 1) {
resourceNameCamelCase += Character.toUpperCase(item.charAt(0));
}
op.path += item + "/";
}
op.vendorExtensions.put("x-codegen-resourceName", resourceNameCamelCase);
boolean foundInNewList = false;
for (CodegenOperation op1 : newOpList) {
if (!foundInNewList) {