Skip to content
Open
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 @@ -239,4 +239,6 @@ public static enum ENUM_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case,
public static final String INTERFACE_CONTROLLER = "interface-controller";

public static final String IGNORE_IMPORT_MAPPING_OPTION = "ignoreImportMappings";

public static final String DATE_LIBRARY = "dateLibrary";
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code

static Logger LOGGER = LoggerFactory.getLogger(AbstractJavaCodegen.class);
public static final String FULL_JAVA_UTIL = "fullJavaUtil";
/** @deprecated Use {@link CodegenConstants#DATE_LIBRARY} instead. */
@Deprecated
public static final String DATE_LIBRARY = CodegenConstants.DATE_LIBRARY;
public static final String DEFAULT_LIBRARY = "<default>";
public static final String DATE_LIBRARY = "dateLibrary";
public static final String JAVA8_MODE = "java8";
public static final String JAVA11_MODE = "java11";
public static final String SUPPORT_ASYNC = "supportAsync";
Expand Down Expand Up @@ -185,7 +187,7 @@ public AbstractJavaCodegen() {
cliOptions.add(CliOption.newBoolean(IGNORE_UNKNOWN_JACKSON_ANNOTATION,
"adds @JsonIgnoreProperties(ignoreUnknown = true) annotation to model classes"));
}
CliOption dateLibrary = new CliOption(DATE_LIBRARY, "Option. Date library to use");
CliOption dateLibrary = new CliOption(CodegenConstants.DATE_LIBRARY, "Option. Date library to use");
Map<String, String> dateOptions = new HashMap<String, String>();
dateOptions.put("java8", "Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets \"" + JAVA8_MODE + "\" to true");
dateOptions.put("java11", "Java 11 native JSR384 (preferred for jdk 11+) - note: this also sets \"" + JAVA11_MODE + "\" to true");
Expand Down Expand Up @@ -491,8 +493,8 @@ public void processOpts() {
}
}

if (additionalProperties.containsKey(DATE_LIBRARY)) {
setDateLibrary(additionalProperties.get("dateLibrary").toString());
if (additionalProperties.containsKey(CodegenConstants.DATE_LIBRARY)) {
setDateLibrary(additionalProperties.get(CodegenConstants.DATE_LIBRARY).toString());
} else if (java8Mode) {
setDateLibrary("java8");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@

public class KotlinClientCodegen extends AbstractKotlinCodegen {

public static final String DATE_LIBRARY = "dateLibrary";
/** @deprecated Use {@link CodegenConstants#DATE_LIBRARY} instead. */
@Deprecated
public static final String DATE_LIBRARY = CodegenConstants.DATE_LIBRARY;
protected CodegenConstants.ENUM_PROPERTY_NAMING_TYPE enumPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.camelCase;
static Logger LOGGER = LoggerFactory.getLogger(KotlinClientCodegen.class);

Expand Down Expand Up @@ -49,7 +51,7 @@ public KotlinClientCodegen() {
apiPackage = packageName + ".apis";
modelPackage = packageName + ".models";

CliOption dateLibrary = new CliOption(DATE_LIBRARY, "Option. Date library to use");
CliOption dateLibrary = new CliOption(CodegenConstants.DATE_LIBRARY, "Option. Date library to use");
Map<String, String> dateOptions = new HashMap<>();
dateOptions.put(DateLibrary.THREETENBP.value, "Threetenbp");
dateOptions.put(DateLibrary.STRING.value, "String");
Expand Down Expand Up @@ -78,8 +80,8 @@ public void setDateLibrary(String library) {
public void processOpts() {
super.processOpts();

if (additionalProperties.containsKey(DATE_LIBRARY)) {
setDateLibrary(additionalProperties.get(DATE_LIBRARY).toString());
if (additionalProperties.containsKey(CodegenConstants.DATE_LIBRARY)) {
setDateLibrary(additionalProperties.get(CodegenConstants.DATE_LIBRARY).toString());
}

if (DateLibrary.THREETENBP.value.equals(dateLibrary)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public void processOpts() {
if (this.java8) {
additionalProperties.put("javaVersion", "1.8");
additionalProperties.put("jdk8", "true");
if (!additionalProperties.containsKey(DATE_LIBRARY)) {
if (!additionalProperties.containsKey(CodegenConstants.DATE_LIBRARY)) {
setDateLibrary("java8");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public JavaOptionsProvider() {
.put(JavaClientCodegen.JAVA8_MODE, JAVA8_MODE_VALUE)
.put(JavaClientCodegen.JAVA11_MODE, JAVA11_MODE_VALUE)
.put(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING, "true")
.put(JavaClientCodegen.DATE_LIBRARY, "joda")
.put(CodegenConstants.DATE_LIBRARY, "joda")
.put(JavaClientCodegen.DISABLE_HTML_ESCAPING, "false")
.put("hideGenerationTimestamp", "true")
.put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public String getLanguage() {
public Map<String, String> createOptions() {
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
builder.put(CodegenConstants.IMPL_FOLDER, IMPL_FOLDER_VALUE)
.put(JavaClientCodegen.DATE_LIBRARY, "joda") //java.lang.IllegalArgumentException: Multiple entries with same key: dateLibrary=joda and dateLibrary=joda
.put(CodegenConstants.DATE_LIBRARY, JODA_DATE_LIBRARY) //java.lang.IllegalArgumentException: Multiple entries with same key: dateLibrary=joda and dateLibrary=joda
.put("title", "Test title")
.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public Map<String, String> createOptions() {
.put(CodegenConstants.GROUP_ID, GROUP_ID)
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER)
.put(CodegenConstants.ENUM_PROPERTY_NAMING, ENUM_PROPERTY_NAMING)
.put(KotlinClientCodegen.DATE_LIBRARY, DATE_LIBRARY)
.put(CodegenConstants.DATE_LIBRARY, DATE_LIBRARY)
.build();
}

Expand Down
Loading