[
https://issues.apache.org/jira/browse/WICKET-6662?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16831644#comment-16831644
]
Andrea Del Bene edited comment on WICKET-6662 at 5/2/19 2:10 PM:
-----------------------------------------------------------------
Most of the work for this issue consists in replacing old classes Time and
Duration with (respectively) standard java.time classes Instant and Duration.
The following two tables show which method of standard classes corresponds to
the current method/constant we are using from legacy classes:
||org.apache.wicket.util.time.Duration||java.time.Duration||
|Duration.minutes|Duration.ofMinutes|
|Duration.seconds|Duration.ofSeconds|
|Duration.milliseconds|Duration.ofMillis|
|Duration.getMilliseconds|Duration.toMillis|
|Duration.seconds()|Duration.toSeconds|
|Duration.NONE|Duration.ZERO|
|Duration.MAXIMUM|Duration.ofMillis(Long.MAX_VALUE)|
||org.apache.wicket.util.time.Time||java.time.Instant||
|Time.now|Instant.now|
| Time.START_OF_UNIX_TIME| Instant.EPOCH|
| Time.millis|Instant.ofEpochMilli|
|Time.add|Instant.plus|
|Time.subtract|Instant.minus|
|Time.GMT|TimeZone.getTimeZone("GMT")|
In addition to these one-by-one replacements I've also added two utility
classes called Durations and Instants which mainly contain date formatters to
convert time entities in a given format, like RFC7231 date format or local
date pattern "yyyy.MM.dd"
was (Author: bitstorm):
Most of the work for this issue consists in replacing old classes Time and
Duration with (respectively) standard java.time classes Instant and Duration.
The following two tables show which method of standard classes corresponds to
the current method/constant we are using from legacy classes:
||org.apache.wicket.util.time.Duration||java.time.Duration||
|Duration.minutes|Duration.ofMinutes|
|Duration.seconds|Duration.ofSeconds|
|Duration.milliseconds|Duration.ofMillis|
|Duration.getMilliseconds|Duration.toMillis|
|Duration.seconds()|Duration.toSeconds|
|Duration.NONE|Duration.ZERO|
|Duration.MAXIMUM|Duration.ofMillis(Long.MAX_VALUE)|
||org.apache.wicket.util.time.Time||java.time.Instant||
|Time.now|Instant.now|
| Time.START_OF_UNIX_TIME| Instant.EPOCH|
| Time.millis|Instant.ofEpochMilli|
|Time.add|Instant.plus|
|Time.subtract|Instant.minus|
|Time.GMT|TimeZone.getTimeZone("GMT")|
> Remove legacy package org.apache.wicket.util.time from wicket-util
> ------------------------------------------------------------------
>
> Key: WICKET-6662
> URL: https://issues.apache.org/jira/browse/WICKET-6662
> Project: Wicket
> Issue Type: Improvement
> Reporter: Andrea Del Bene
> Assignee: Andrea Del Bene
> Priority: Minor
>
> Wicket still use custom classes from package org.apache.wicket.util.time to
> handle and manipulate time entities such as "duration" or "current instant".
> There are in particular two main classes used across the framework: Time and
> Duration. These two classes have the same purpose and functionalities as
> standard classes java.time.Instant and java.time.Duration. Therefore, we
> should consider to switch to standard java.time classes and remove legacy
> package org.apache.wicket.util.time.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)