mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-08 00:20:51 +00:00
update samples
This commit is contained in:
parent
b05604dab7
commit
c010c89915
@ -22,43 +22,47 @@ import java.time.format.DateTimeParseException;
|
||||
*/
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class JavaTimeFormatter {
|
||||
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
||||
|
||||
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
||||
/**
|
||||
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||
*
|
||||
* @return DateTimeFormatter
|
||||
*/
|
||||
public DateTimeFormatter getOffsetDateTimeFormatter() {
|
||||
return offsetDateTimeFormatter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||
* @return DateTimeFormatter
|
||||
*/
|
||||
public DateTimeFormatter getOffsetDateTimeFormatter() {
|
||||
return offsetDateTimeFormatter;
|
||||
}
|
||||
/**
|
||||
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||
*
|
||||
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
|
||||
*/
|
||||
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
|
||||
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
|
||||
*/
|
||||
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
|
||||
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
|
||||
/**
|
||||
* Parse the given string into {@code OffsetDateTime} object.
|
||||
*
|
||||
* @param str String
|
||||
* @return {@code OffsetDateTime}
|
||||
*/
|
||||
public OffsetDateTime parseOffsetDateTime(String str) {
|
||||
try {
|
||||
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
|
||||
} catch (DateTimeParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given string into {@code OffsetDateTime} object.
|
||||
* @param str String
|
||||
* @return {@code OffsetDateTime}
|
||||
*/
|
||||
public OffsetDateTime parseOffsetDateTime(String str) {
|
||||
try {
|
||||
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
|
||||
} catch (DateTimeParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Format the given {@code OffsetDateTime} object into string.
|
||||
* @param offsetDateTime {@code OffsetDateTime}
|
||||
* @return {@code OffsetDateTime} in string format
|
||||
*/
|
||||
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
|
||||
return offsetDateTimeFormatter.format(offsetDateTime);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Format the given {@code OffsetDateTime} object into string.
|
||||
*
|
||||
* @param offsetDateTime {@code OffsetDateTime}
|
||||
* @return {@code OffsetDateTime} in string format
|
||||
*/
|
||||
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
|
||||
return offsetDateTimeFormatter.format(offsetDateTime);
|
||||
}
|
||||
}
|
@ -22,43 +22,47 @@ import java.time.format.DateTimeParseException;
|
||||
*/
|
||||
@jakarta.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class JavaTimeFormatter {
|
||||
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
||||
|
||||
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
||||
/**
|
||||
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||
*
|
||||
* @return DateTimeFormatter
|
||||
*/
|
||||
public DateTimeFormatter getOffsetDateTimeFormatter() {
|
||||
return offsetDateTimeFormatter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||
* @return DateTimeFormatter
|
||||
*/
|
||||
public DateTimeFormatter getOffsetDateTimeFormatter() {
|
||||
return offsetDateTimeFormatter;
|
||||
}
|
||||
/**
|
||||
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||
*
|
||||
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
|
||||
*/
|
||||
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
|
||||
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
|
||||
*/
|
||||
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
|
||||
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
|
||||
/**
|
||||
* Parse the given string into {@code OffsetDateTime} object.
|
||||
*
|
||||
* @param str String
|
||||
* @return {@code OffsetDateTime}
|
||||
*/
|
||||
public OffsetDateTime parseOffsetDateTime(String str) {
|
||||
try {
|
||||
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
|
||||
} catch (DateTimeParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given string into {@code OffsetDateTime} object.
|
||||
* @param str String
|
||||
* @return {@code OffsetDateTime}
|
||||
*/
|
||||
public OffsetDateTime parseOffsetDateTime(String str) {
|
||||
try {
|
||||
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
|
||||
} catch (DateTimeParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Format the given {@code OffsetDateTime} object into string.
|
||||
* @param offsetDateTime {@code OffsetDateTime}
|
||||
* @return {@code OffsetDateTime} in string format
|
||||
*/
|
||||
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
|
||||
return offsetDateTimeFormatter.format(offsetDateTime);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Format the given {@code OffsetDateTime} object into string.
|
||||
*
|
||||
* @param offsetDateTime {@code OffsetDateTime}
|
||||
* @return {@code OffsetDateTime} in string format
|
||||
*/
|
||||
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
|
||||
return offsetDateTimeFormatter.format(offsetDateTime);
|
||||
}
|
||||
}
|
@ -22,43 +22,47 @@ import java.time.format.DateTimeParseException;
|
||||
*/
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class JavaTimeFormatter {
|
||||
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
||||
|
||||
private DateTimeFormatter offsetDateTimeFormatter = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
||||
/**
|
||||
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||
*
|
||||
* @return DateTimeFormatter
|
||||
*/
|
||||
public DateTimeFormatter getOffsetDateTimeFormatter() {
|
||||
return offsetDateTimeFormatter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||
* @return DateTimeFormatter
|
||||
*/
|
||||
public DateTimeFormatter getOffsetDateTimeFormatter() {
|
||||
return offsetDateTimeFormatter;
|
||||
}
|
||||
/**
|
||||
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||
*
|
||||
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
|
||||
*/
|
||||
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
|
||||
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the date format used to parse/format {@code OffsetDateTime} parameters.
|
||||
* @param offsetDateTimeFormatter {@code DateTimeFormatter}
|
||||
*/
|
||||
public void setOffsetDateTimeFormatter(DateTimeFormatter offsetDateTimeFormatter) {
|
||||
this.offsetDateTimeFormatter = offsetDateTimeFormatter;
|
||||
/**
|
||||
* Parse the given string into {@code OffsetDateTime} object.
|
||||
*
|
||||
* @param str String
|
||||
* @return {@code OffsetDateTime}
|
||||
*/
|
||||
public OffsetDateTime parseOffsetDateTime(String str) {
|
||||
try {
|
||||
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
|
||||
} catch (DateTimeParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the given string into {@code OffsetDateTime} object.
|
||||
* @param str String
|
||||
* @return {@code OffsetDateTime}
|
||||
*/
|
||||
public OffsetDateTime parseOffsetDateTime(String str) {
|
||||
try {
|
||||
return OffsetDateTime.parse(str, offsetDateTimeFormatter);
|
||||
} catch (DateTimeParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Format the given {@code OffsetDateTime} object into string.
|
||||
* @param offsetDateTime {@code OffsetDateTime}
|
||||
* @return {@code OffsetDateTime} in string format
|
||||
*/
|
||||
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
|
||||
return offsetDateTimeFormatter.format(offsetDateTime);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Format the given {@code OffsetDateTime} object into string.
|
||||
*
|
||||
* @param offsetDateTime {@code OffsetDateTime}
|
||||
* @return {@code OffsetDateTime} in string format
|
||||
*/
|
||||
public String formatOffsetDateTime(OffsetDateTime offsetDateTime) {
|
||||
return offsetDateTimeFormatter.format(offsetDateTime);
|
||||
}
|
||||
}
|
@ -15,43 +15,23 @@ package org.openapitools.client;
|
||||
|
||||
@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.15.0-SNAPSHOT")
|
||||
public class Pair {
|
||||
private String name = "";
|
||||
private String value = "";
|
||||
private final String name;
|
||||
private final String value;
|
||||
|
||||
public Pair (String name, String value) {
|
||||
setName(name);
|
||||
setValue(value);
|
||||
}
|
||||
public Pair(String name, String value) {
|
||||
this.name = isValidString(name) ? name : "";
|
||||
this.value = isValidString(value) ? value : "";
|
||||
}
|
||||
|
||||
private void setName(String name) {
|
||||
if (!isValidString(name)) {
|
||||
return;
|
||||
}
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
this.name = name;
|
||||
}
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
private void setValue(String value) {
|
||||
if (!isValidString(value)) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
private boolean isValidString(String arg) {
|
||||
if (arg == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
private static boolean isValidString(String arg) {
|
||||
return arg != null;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user