Skip to content

Commit

Permalink
fix: Update Kind to NON_GENERATED
Browse files Browse the repository at this point in the history
  • Loading branch information
lqiu96 committed Jan 11, 2023
1 parent 168a925 commit d7ebc76
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public enum Kind {
MAIN,
STUB,
TEST,
PROTO
PROTO,
NON_GENERATED
};

public abstract Kind kind();
Expand All @@ -42,8 +43,6 @@ public enum Kind {
// Only used for generating the region tag for samples; therefore only used in select Composers.
public abstract String apiVersion();

public abstract boolean shouldGenerateClass();

/**
* Create an empty GapicClass with minimal information. This is intended to be used for
* GapicClasses that will not generate any Java files
Expand All @@ -52,14 +51,13 @@ public enum Kind {
*/
public static GapicClass createNonGeneratedGapicClass() {
return builder()
.setKind(Kind.STUB)
.setKind(Kind.NON_GENERATED)
.setClassDefinition(
ClassDefinition.builder()
.setPackageString("Empty Package")
.setName("Empty Name")
.setScope(ScopeNode.PUBLIC)
.build())
.setShouldGenerateClass(false)
.build();
}

Expand All @@ -76,8 +74,7 @@ static Builder builder() {
return new AutoValue_GapicClass.Builder()
.setSamples(Collections.emptyList())
.setApiShortName("")
.setApiVersion("")
.setShouldGenerateClass(true);
.setApiVersion("");
}

abstract Builder toBuilder();
Expand Down Expand Up @@ -106,8 +103,6 @@ abstract static class Builder {

abstract Builder setApiVersion(String apiVersion);

abstract Builder setShouldGenerateClass(boolean shouldGenerateClass);

abstract GapicClass build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static CodeGeneratorResponse write(
}

for (GapicClass gapicClazz : clazzes) {
if (!gapicClazz.shouldGenerateClass()) {
if (gapicClazz.kind() == GapicClass.Kind.NON_GENERATED) {
continue;
}
String classPath = writeClazz(gapicClazz, codeWriter, jos);
Expand Down

0 comments on commit d7ebc76

Please sign in to comment.