[Java] Make Java ApiClient extendable (#21251)

* Make all Java ApiClients in templates extendable

* Make all Java ApiClients in samples extendable

* Fix compilation of enum constructor

* Fix compilation of enum constructor in templates
This commit is contained in:
Alex B
2025-05-11 14:47:40 +00:00
committed by GitHub
parent be17698320
commit 57bf6925bb
89 changed files with 1243 additions and 1243 deletions

View File

@@ -31,14 +31,14 @@ import java.io.OutputStream;
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.14.0-SNAPSHOT")
public class ApiClient {
private final String basePath;
private final HttpRequestFactory httpRequestFactory;
private final ObjectMapper objectMapper;
protected final String basePath;
protected final HttpRequestFactory httpRequestFactory;
protected final ObjectMapper objectMapper;
private static final String defaultBasePath = "http://petstore.swagger.io:80/v2";
protected static final String defaultBasePath = "http://petstore.swagger.io:80/v2";
// A reasonable default object mapper. Client can pass in a chosen ObjectMapper anyway, this is just for reasonable defaults.
private static ObjectMapper createDefaultObjectMapper() {
protected static ObjectMapper createDefaultObjectMapper() {
ObjectMapper objectMapper = new ObjectMapper()
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS)
@@ -80,7 +80,7 @@ public class ApiClient {
public class JacksonJsonHttpContent extends AbstractHttpContent {
/* A POJO that can be serialized with a com.fasterxml Jackson ObjectMapper */
private final Object data;
protected final Object data;
public JacksonJsonHttpContent(Object data) {
super(Json.MEDIA_TYPE);