Skip to content

Commit

Permalink
[ggj][resname] fix: Fix resname helper method names for of* and forma…
Browse files Browse the repository at this point in the history
…t* (#408)

* fix: refactor requestBuilder into separate method in ServiceClientClassComposer

* feat: add varargs to AnonClass and ref setter methods

* feat: add HTTP annotation parsing/validation

* feat: Generate RequestParamsExtractor in GrpcServiceStub

* feat: add GrpcPublisherStub test to exercise HTTP subfields

* fix: add ByteString to DefaultValueComposer

* fix: Use repeated field name for paged RPC unit tests

* fix: refactor exception field, use paged repeated field name, add pubsub client test

* fix: ensure all testgen methods throw Exceptions

* fix: Fix resname helper method names for of* and format*
  • Loading branch information
miraleung authored Oct 24, 2020
1 parent 8b8e3d9 commit 31d9be6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,8 @@ private static List<MethodDefinition> createOfOrFormatMethodHelper(
.setReturnType(returnType)
.setName(
String.format(
methodNameFormat, i == 0 ? "" : getBuilderTypeName(tokenHierarchies, i)))
methodNameFormat,
i == 0 ? "" : concatToUpperCamelCaseName(tokenHierarchies.get(i)) + "Name"))
.setArguments(methodArgs)
.setReturnExpr(returnExpr)
.build());
Expand All @@ -537,7 +538,10 @@ private static List<MethodDefinition> createOfOrFormatMethodHelper(
.setIsStatic(true)
.setAnnotations(annotations)
.setReturnType(returnType)
.setName(String.format(methodNameFormat, getBuilderTypeName(tokens)))
.setName(
String.format(
methodNameFormat,
concatToUpperCamelCaseName(tokenHierarchies.get(i)) + "Name"))
.setArguments(methodArgs)
.setReturnExpr(returnExpr)
.build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ public class FoobarName implements ResourceName {
}

@BetaApi("The static create methods are not stable yet and may be changed in the future.")
public static FoobarName ofProjectFoobarBuilder(String project, String foobar) {
public static FoobarName ofProjectFoobarName(String project, String foobar) {
return newBuilder().setProject(project).setFoobar(foobar).build();
}

@BetaApi("The static create methods are not stable yet and may be changed in the future.")
public static FoobarName ofProjectVariantFoobarBuilder(
public static FoobarName ofProjectVariantFoobarName(
String project, String variant, String foobar) {
return newProjectVariantFoobarBuilder()
.setProject(project)
Expand All @@ -128,12 +128,12 @@ public class FoobarName implements ResourceName {
}

@BetaApi("The static create methods are not stable yet and may be changed in the future.")
public static FoobarName ofFoobarBuilder(String foobar) {
public static FoobarName ofFoobarName(String foobar) {
return newFoobarBuilder().setFoobar(foobar).build();
}

@BetaApi("The static create methods are not stable yet and may be changed in the future.")
public static FoobarName ofBarFooFoobarBuilder(String barFoo, String foobar) {
public static FoobarName ofBarFooFoobarName(String barFoo, String foobar) {
return newBarFooFoobarBuilder().setBarFoo(barFoo).setFoobar(foobar).build();
}

Expand All @@ -142,12 +142,12 @@ public class FoobarName implements ResourceName {
}

@BetaApi("The static format methods are not stable yet and may be changed in the future.")
public static String formatProjectFoobarBuilder(String project, String foobar) {
public static String formatProjectFoobarName(String project, String foobar) {
return newBuilder().setProject(project).setFoobar(foobar).build().toString();
}

@BetaApi("The static format methods are not stable yet and may be changed in the future.")
public static String formatProjectVariantFoobarBuilder(
public static String formatProjectVariantFoobarName(
String project, String variant, String foobar) {
return newProjectVariantFoobarBuilder()
.setProject(project)
Expand All @@ -158,12 +158,12 @@ public class FoobarName implements ResourceName {
}

@BetaApi("The static format methods are not stable yet and may be changed in the future.")
public static String formatFoobarBuilder(String foobar) {
public static String formatFoobarName(String foobar) {
return newFoobarBuilder().setFoobar(foobar).build().toString();
}

@BetaApi("The static format methods are not stable yet and may be changed in the future.")
public static String formatBarFooFoobarBuilder(String barFoo, String foobar) {
public static String formatBarFooFoobarName(String barFoo, String foobar) {
return newBarFooFoobarBuilder().setBarFoo(barFoo).setFoobar(foobar).build().toString();
}

Expand Down

0 comments on commit 31d9be6

Please sign in to comment.