-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
[java] Support 'time-local' format #23555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |||||||
| import com.fasterxml.jackson.annotation.JsonCreator; | ||||||||
| import java.math.BigDecimal; | ||||||||
| import java.time.LocalDate; | ||||||||
| import java.time.LocalTime; | ||||||||
| import java.time.OffsetDateTime; | ||||||||
| import org.springframework.format.annotation.DateTimeFormat; | ||||||||
| import org.springframework.lang.Nullable; | ||||||||
|
|
@@ -40,6 +41,8 @@ public class Pet { | |||||||
| @DateTimeFormat(iso = DateTimeFormat.ISO.DATE) | ||||||||
| private LocalDate dateOfBirth = LocalDate.parse("2021-01-01"); | ||||||||
|
|
||||||||
| private LocalTime feedingTime = LocalTime.parse("10:15:30"); | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: New Prompt for AI agents
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Do I need to add it ? I'm not sure any Spring Boot 2 users will want to use a recent generator anyway... see #23269
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm also open to create another PR that drop this annotation |
||||||||
|
|
||||||||
| public Pet() { | ||||||||
| super(); | ||||||||
| } | ||||||||
|
|
@@ -177,6 +180,27 @@ public void setDateOfBirth(LocalDate dateOfBirth) { | |||||||
| this.dateOfBirth = dateOfBirth; | ||||||||
| } | ||||||||
|
|
||||||||
| public Pet feedingTime(LocalTime feedingTime) { | ||||||||
| this.feedingTime = feedingTime; | ||||||||
| return this; | ||||||||
| } | ||||||||
|
|
||||||||
| /** | ||||||||
| * Get feedingTime | ||||||||
| * @return feedingTime | ||||||||
| */ | ||||||||
| @Valid | ||||||||
| @Schema(name = "feedingTime", requiredMode = Schema.RequiredMode.NOT_REQUIRED) | ||||||||
| @JsonProperty("feedingTime") | ||||||||
| public LocalTime getFeedingTime() { | ||||||||
| return feedingTime; | ||||||||
| } | ||||||||
|
|
||||||||
| @JsonProperty("feedingTime") | ||||||||
| public void setFeedingTime(LocalTime feedingTime) { | ||||||||
| this.feedingTime = feedingTime; | ||||||||
| } | ||||||||
|
|
||||||||
| @Override | ||||||||
| public boolean equals(Object o) { | ||||||||
| if (this == o) { | ||||||||
|
|
@@ -191,12 +215,13 @@ public boolean equals(Object o) { | |||||||
| Objects.equals(this.happy, pet.happy) && | ||||||||
| Objects.equals(this.price, pet.price) && | ||||||||
| Objects.equals(this.lastFeed, pet.lastFeed) && | ||||||||
| Objects.equals(this.dateOfBirth, pet.dateOfBirth); | ||||||||
| Objects.equals(this.dateOfBirth, pet.dateOfBirth) && | ||||||||
| Objects.equals(this.feedingTime, pet.feedingTime); | ||||||||
| } | ||||||||
|
|
||||||||
| @Override | ||||||||
| public int hashCode() { | ||||||||
| return Objects.hash(atType, age, happy, price, lastFeed, dateOfBirth); | ||||||||
| return Objects.hash(atType, age, happy, price, lastFeed, dateOfBirth, feedingTime); | ||||||||
| } | ||||||||
|
|
||||||||
| @Override | ||||||||
|
|
@@ -209,6 +234,7 @@ public String toString() { | |||||||
| sb.append(" price: ").append(toIndentedString(price)).append("\n"); | ||||||||
| sb.append(" lastFeed: ").append(toIndentedString(lastFeed)).append("\n"); | ||||||||
| sb.append(" dateOfBirth: ").append(toIndentedString(dateOfBirth)).append("\n"); | ||||||||
| sb.append(" feedingTime: ").append(toIndentedString(feedingTime)).append("\n"); | ||||||||
| sb.append("}"); | ||||||||
| return sb.toString(); | ||||||||
| } | ||||||||
|
|
||||||||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2:
time-localdefaults are skipped forjava8-localdatetimebecause default generation checks"java8".equals(getDateLibrary())while type mapping usesdateLibrary.startsWith("java8").Prompt for AI agents