@@ -40,6 +40,7 @@ public final class GeneratorSettings implements Serializable {
4040 private String modelPackage ;
4141 private String invokerPackage ;
4242 private String packageName ;
43+ private String apiNameSuffix ;
4344 private String modelNamePrefix ;
4445 private String modelNameSuffix ;
4546 private String groupId ;
@@ -106,6 +107,21 @@ public String getPackageName() {
106107 return packageName ;
107108 }
108109
110+ /**
111+ * Gets a api name suffix for generated models. This name will be appended to a api name.
112+ * <p>
113+ * This option is often used to circumvent compilation issues where models match keywords.
114+ * <p>
115+ * Example:
116+ * <p>
117+ * Suffix <code>Gen</code> applied to <code>Object</code> results in a generated class named <code>ObjectGen</code>.
118+ *
119+ * @return the model name suffix
120+ */
121+ public String getApiNameSuffix () {
122+ return apiNameSuffix ;
123+ }
124+
109125 /**
110126 * Gets a model name prefix for generated models. This name will be prefixed to a model name.
111127 * <p>
@@ -325,6 +341,7 @@ private GeneratorSettings(Builder builder) {
325341 modelPackage = builder .modelPackage ;
326342 invokerPackage = builder .invokerPackage ;
327343 packageName = builder .packageName ;
344+ apiNameSuffix = builder .apiNameSuffix ;
328345 modelNamePrefix = builder .modelNamePrefix ;
329346 modelNameSuffix = builder .modelNameSuffix ;
330347 groupId = builder .groupId ;
@@ -366,6 +383,9 @@ private GeneratorSettings(Builder builder) {
366383 if (isNotEmpty (artifactVersion )) {
367384 additional .put ("artifactVersion" , artifactVersion );
368385 }
386+ if (isNotEmpty (apiNameSuffix )) {
387+ additional .put ("apiNameSuffix" , apiNameSuffix );
388+ }
369389 if (isNotEmpty (modelNamePrefix )) {
370390 additional .put ("modelNamePrefix" , modelNamePrefix );
371391 }
@@ -433,6 +453,7 @@ public static Builder newBuilder(GeneratorSettings copy) {
433453 builder .modelPackage = copy .getModelPackage ();
434454 builder .invokerPackage = copy .getInvokerPackage ();
435455 builder .packageName = copy .getPackageName ();
456+ builder .apiNameSuffix = copy .getApiNameSuffix ();
436457 builder .modelNamePrefix = copy .getModelNamePrefix ();
437458 builder .modelNameSuffix = copy .getModelNameSuffix ();
438459 builder .groupId = copy .getGroupId ();
@@ -479,6 +500,7 @@ public static final class Builder {
479500 private String modelPackage ;
480501 private String invokerPackage ;
481502 private String packageName ;
503+ private String apiNameSuffix ;
482504 private String modelNamePrefix ;
483505 private String modelNameSuffix ;
484506 private String groupId ;
@@ -571,6 +593,17 @@ public Builder withPackageName(String packageName) {
571593 return this ;
572594 }
573595
596+ /**
597+ * Sets the {@code apiNameSuffix} and returns a reference to this Builder so that the methods can be chained together.
598+ *
599+ * @param apiNameSuffix the {@code apiNameSuffix} to set
600+ * @return a reference to this Builder
601+ */
602+ public Builder withApiNameSuffix (String apiNameSuffix ) {
603+ this .apiNameSuffix = apiNameSuffix ;
604+ return this ;
605+ }
606+
574607 /**
575608 * Sets the {@code modelNamePrefix} and returns a reference to this Builder so that the methods can be chained together.
576609 *
@@ -880,6 +913,7 @@ public String toString() {
880913 ", modelPackage='" + modelPackage + '\'' +
881914 ", invokerPackage='" + invokerPackage + '\'' +
882915 ", packageName='" + packageName + '\'' +
916+ ", apiNameSuffix='" + apiNameSuffix + '\'' +
883917 ", modelNamePrefix='" + modelNamePrefix + '\'' +
884918 ", modelNameSuffix='" + modelNameSuffix + '\'' +
885919 ", groupId='" + groupId + '\'' +
@@ -910,6 +944,7 @@ public boolean equals(Object o) {
910944 Objects .equals (getModelPackage (), that .getModelPackage ()) &&
911945 Objects .equals (getInvokerPackage (), that .getInvokerPackage ()) &&
912946 Objects .equals (getPackageName (), that .getPackageName ()) &&
947+ Objects .equals (getApiNameSuffix (), that .getApiNameSuffix ()) &&
913948 Objects .equals (getModelNamePrefix (), that .getModelNamePrefix ()) &&
914949 Objects .equals (getModelNameSuffix (), that .getModelNameSuffix ()) &&
915950 Objects .equals (getGroupId (), that .getGroupId ()) &&
@@ -937,6 +972,7 @@ public int hashCode() {
937972 getModelPackage (),
938973 getInvokerPackage (),
939974 getPackageName (),
975+ getApiNameSuffix (),
940976 getModelNamePrefix (),
941977 getModelNameSuffix (),
942978 getGroupId (),
0 commit comments