Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ggj][codegen][resname] fix: propagate of*Name changes to resname class #410

Merged
merged 15 commits into from
Oct 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ private static MethodDefinition createParseMethod(
}

IfStatement.Builder ifStatementBuilder = IfStatement.builder();
String ofMethodNamePattern = "of%s";
String ofMethodNamePattern = "of%sName";
for (int i = 0; i < tokenHierarchies.size(); i++) {
VariableExpr templateVarExpr = templateFinalVarExprs.get(i);
MethodInvocationExpr conditionExpr =
Expand All @@ -688,7 +688,7 @@ private static MethodDefinition createParseMethod(
List<String> tokens = tokenHierarchies.get(i);
MethodInvocationExpr ofMethodExpr =
MethodInvocationExpr.builder()
.setMethodName(String.format(ofMethodNamePattern, getBuilderTypeName(tokens)))
.setMethodName(String.format(ofMethodNamePattern, concatToUpperCamelCaseName(tokens)))
.setArguments(
tokens.stream()
.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,17 +173,17 @@ public class FoobarName implements ResourceName {
}
if (PROJECT_FOOBAR.matches(formattedString)) {
Map<String, String> matchMap = PROJECT_FOOBAR.match(formattedString);
return ofProjectFoobarBuilder(matchMap.get("project"), matchMap.get("foobar"));
return ofProjectFoobarName(matchMap.get("project"), matchMap.get("foobar"));
} else if (PROJECT_VARIANT_FOOBAR.matches(formattedString)) {
Map<String, String> matchMap = PROJECT_VARIANT_FOOBAR.match(formattedString);
return ofProjectVariantFoobarBuilder(
return ofProjectVariantFoobarName(
matchMap.get("project"), matchMap.get("variant"), matchMap.get("foobar"));
} else if (FOOBAR.matches(formattedString)) {
Map<String, String> matchMap = FOOBAR.match(formattedString);
return ofFoobarBuilder(matchMap.get("foobar"));
return ofFoobarName(matchMap.get("foobar"));
} else if (BAR_FOO_FOOBAR.matches(formattedString)) {
Map<String, String> matchMap = BAR_FOO_FOOBAR.match(formattedString);
return ofBarFooFoobarBuilder(matchMap.get("bar_foo"), matchMap.get("foobar"));
return ofBarFooFoobarName(matchMap.get("bar_foo"), matchMap.get("foobar"));
}
throw new ValidationException("FoobarName.parse: formattedString not in valid format");
}
Expand Down