Skip to content

Commit c010c89

Browse files
committed
update samples
1 parent b05604d commit c010c89

File tree

4 files changed

+132
-140
lines changed

4 files changed

+132
-140
lines changed

samples/client/others/java/restclient-enum-in-multipart/src/main/java/org/openapitools/client/JavaTimeFormatter.java

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,43 +22,47 @@
2222
*/
2323
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
2424
public class JavaTimeFormatter {
25+
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
2526

26-
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
27+
/**
28+
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
29+
*
30+
* @return DateTimeFormatter
31+
*/
32+
public DateTimeFormatter getOffsetDateTimeFormatter() {
33+
return offsetDateTimeFormatter;
34+
}
2735

28-
/**
29-
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
30-
* @return DateTimeFormatter
31-
*/
32-
public DateTimeFormatter getOffsetDateTimeFormatter() {
33-
return offsetDateTimeFormatter;
34-
}
36+
/**
37+
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
38+
*
39+
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
40+
*/
41+
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
42+
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
43+
}
3544

36-
/**
37-
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
38-
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
39-
*/
40-
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
41-
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
45+
/**
46+
* Parse the given string into {@code OffsetDateTime} object.
47+
*
48+
* @param str String
49+
* @return {@code OffsetDateTime}
50+
*/
51+
public OffsetDateTime parseOffsetDateTime(String str) {
52+
try {
53+
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
54+
} catch (DateTimeParseException e) {
55+
throw new RuntimeException(e);
4256
}
57+
}
4358

44-
/**
45-
* Parse the given string into {@code OffsetDateTime} object.
46-
* @param str String
47-
* @return {@code OffsetDateTime}
48-
*/
49-
public OffsetDateTime parseOffsetDateTime(String str) {
50-
try {
51-
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
52-
} catch (DateTimeParseException e) {
53-
throw new RuntimeException(e);
54-
}
55-
}
56-
/**
57-
* Format the given {@code OffsetDateTime} object into string.
58-
* @param offsetDateTime {@code OffsetDateTime}
59-
* @return {@code OffsetDateTime} in string format
60-
*/
61-
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
62-
return offsetDateTimeFormatter.format(offsetDateTime);
63-
}
64-
}
59+
/**
60+
* Format the given {@code OffsetDateTime} object into string.
61+
*
62+
* @param offsetDateTime {@code OffsetDateTime}
63+
* @return {@code OffsetDateTime} in string format
64+
*/
65+
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
66+
return offsetDateTimeFormatter.format(offsetDateTime);
67+
}
68+
}

samples/client/petstore/java/restclient-useSingleRequestParameter-static/src/main/java/org/openapitools/client/JavaTimeFormatter.java

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,43 +22,47 @@
2222
*/
2323
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
2424
public class JavaTimeFormatter {
25+
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
2526

26-
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
27+
/**
28+
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
29+
*
30+
* @return DateTimeFormatter
31+
*/
32+
public DateTimeFormatter getOffsetDateTimeFormatter() {
33+
return offsetDateTimeFormatter;
34+
}
2735

28-
/**
29-
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
30-
* @return DateTimeFormatter
31-
*/
32-
public DateTimeFormatter getOffsetDateTimeFormatter() {
33-
return offsetDateTimeFormatter;
34-
}
36+
/**
37+
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
38+
*
39+
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
40+
*/
41+
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
42+
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
43+
}
3544

36-
/**
37-
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
38-
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
39-
*/
40-
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
41-
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
45+
/**
46+
* Parse the given string into {@code OffsetDateTime} object.
47+
*
48+
* @param str String
49+
* @return {@code OffsetDateTime}
50+
*/
51+
public OffsetDateTime parseOffsetDateTime(String str) {
52+
try {
53+
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
54+
} catch (DateTimeParseException e) {
55+
throw new RuntimeException(e);
4256
}
57+
}
4358

44-
/**
45-
* Parse the given string into {@code OffsetDateTime} object.
46-
* @param str String
47-
* @return {@code OffsetDateTime}
48-
*/
49-
public OffsetDateTime parseOffsetDateTime(String str) {
50-
try {
51-
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
52-
} catch (DateTimeParseException e) {
53-
throw new RuntimeException(e);
54-
}
55-
}
56-
/**
57-
* Format the given {@code OffsetDateTime} object into string.
58-
* @param offsetDateTime {@code OffsetDateTime}
59-
* @return {@code OffsetDateTime} in string format
60-
*/
61-
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
62-
return offsetDateTimeFormatter.format(offsetDateTime);
63-
}
64-
}
59+
/**
60+
* Format the given {@code OffsetDateTime} object into string.
61+
*
62+
* @param offsetDateTime {@code OffsetDateTime}
63+
* @return {@code OffsetDateTime} in string format
64+
*/
65+
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
66+
return offsetDateTimeFormatter.format(offsetDateTime);
67+
}
68+
}

samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/JavaTimeFormatter.java

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,43 +22,47 @@
2222
*/
2323
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
2424
public class JavaTimeFormatter {
25+
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
2526

26-
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
27+
/**
28+
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
29+
*
30+
* @return DateTimeFormatter
31+
*/
32+
public DateTimeFormatter getOffsetDateTimeFormatter() {
33+
return offsetDateTimeFormatter;
34+
}
2735

28-
/**
29-
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
30-
* @return DateTimeFormatter
31-
*/
32-
public DateTimeFormatter getOffsetDateTimeFormatter() {
33-
return offsetDateTimeFormatter;
34-
}
36+
/**
37+
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
38+
*
39+
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
40+
*/
41+
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
42+
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
43+
}
3544

36-
/**
37-
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
38-
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
39-
*/
40-
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
41-
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
45+
/**
46+
* Parse the given string into {@code OffsetDateTime} object.
47+
*
48+
* @param str String
49+
* @return {@code OffsetDateTime}
50+
*/
51+
public OffsetDateTime parseOffsetDateTime(String str) {
52+
try {
53+
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
54+
} catch (DateTimeParseException e) {
55+
throw new RuntimeException(e);
4256
}
57+
}
4358

44-
/**
45-
* Parse the given string into {@code OffsetDateTime} object.
46-
* @param str String
47-
* @return {@code OffsetDateTime}
48-
*/
49-
public OffsetDateTime parseOffsetDateTime(String str) {
50-
try {
51-
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
52-
} catch (DateTimeParseException e) {
53-
throw new RuntimeException(e);
54-
}
55-
}
56-
/**
57-
* Format the given {@code OffsetDateTime} object into string.
58-
* @param offsetDateTime {@code OffsetDateTime}
59-
* @return {@code OffsetDateTime} in string format
60-
*/
61-
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
62-
return offsetDateTimeFormatter.format(offsetDateTime);
63-
}
64-
}
59+
/**
60+
* Format the given {@code OffsetDateTime} object into string.
61+
*
62+
* @param offsetDateTime {@code OffsetDateTime}
63+
* @return {@code OffsetDateTime} in string format
64+
*/
65+
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
66+
return offsetDateTimeFormatter.format(offsetDateTime);
67+
}
68+
}

samples/client/petstore/java/vertx-supportVertxFuture/src/main/java/org/openapitools/client/Pair.java

Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,23 @@
1515

1616
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
1717
public class Pair {
18-
private String name = "";
19-
private String value = "";
18+
private final String name;
19+
private final String value;
2020

21-
public Pair (String name, String value) {
22-
setName(name);
23-
setValue(value);
24-
}
21+
public Pair(String name, String value) {
22+
this.name = isValidString(name) ? name : "";
23+
this.value = isValidString(value) ? value : "";
24+
}
2525

26-
private void setName(String name) {
27-
if (!isValidString(name)) {
28-
return;
29-
}
26+
public String getName() {
27+
return this.name;
28+
}
3029

31-
this.name = name;
32-
}
30+
public String getValue() {
31+
return this.value;
32+
}
3333

34-
private void setValue(String value) {
35-
if (!isValidString(value)) {
36-
return;
37-
}
38-
39-
this.value = value;
40-
}
41-
42-
public String getName() {
43-
return this.name;
44-
}
45-
46-
public String getValue() {
47-
return this.value;
48-
}
49-
50-
private boolean isValidString(String arg) {
51-
if (arg == null) {
52-
return false;
53-
}
54-
55-
return true;
56-
}
34+
private static boolean isValidString(String arg) {
35+
return arg != null;
36+
}
5737
}

0 commit comments

Comments
 (0)