-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
removed dependency on velocypack-module-jdk8 and velocypack-module-joda
- Loading branch information
Showing
7 changed files
with
172 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
src/main/java/com/arangodb/springframework/core/convert/JavaTimeUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* DISCLAIMER | ||
* | ||
* Copyright 2018 ArangoDB GmbH, Cologne, Germany | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* Copyright holder is ArangoDB GmbH, Cologne, Germany | ||
*/ | ||
|
||
package com.arangodb.springframework.core.convert; | ||
|
||
import java.time.Instant; | ||
import java.time.LocalDate; | ||
import java.time.LocalDateTime; | ||
import java.time.OffsetDateTime; | ||
import java.time.ZonedDateTime; | ||
import java.time.format.DateTimeFormatter; | ||
|
||
/** | ||
* @author Mark Vollmary | ||
* | ||
*/ | ||
public class JavaTimeUtil { | ||
|
||
private JavaTimeUtil() { | ||
super(); | ||
} | ||
|
||
public static String format(final Instant source) { | ||
return DateTimeFormatter.ISO_INSTANT.format(source); | ||
} | ||
|
||
public static String format(final LocalDate source) { | ||
return DateTimeFormatter.ISO_LOCAL_DATE.format(source); | ||
} | ||
|
||
public static String format(final OffsetDateTime source) { | ||
return DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(source); | ||
} | ||
|
||
public static String format(final LocalDateTime source) { | ||
return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(source); | ||
} | ||
|
||
public static String format(final ZonedDateTime source) { | ||
return DateTimeFormatter.ISO_ZONED_DATE_TIME.format(source); | ||
} | ||
|
||
public static Instant parseInstant(final CharSequence source) { | ||
return Instant.parse(source); | ||
} | ||
|
||
public static LocalDate parseLocalDate(final CharSequence source) { | ||
return LocalDate.parse(source); | ||
} | ||
|
||
public static LocalDateTime parseLocalDateTime(final CharSequence source) { | ||
return LocalDateTime.parse(source); | ||
} | ||
|
||
public static OffsetDateTime parseOffsetDateTime(final CharSequence source) { | ||
return OffsetDateTime.parse(source); | ||
} | ||
|
||
public static ZonedDateTime parseZonedDateTime(final CharSequence source) { | ||
return ZonedDateTime.parse(source); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
src/main/java/com/arangodb/springframework/core/convert/JodaTimeUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* DISCLAIMER | ||
* | ||
* Copyright 2016 ArangoDB GmbH, Cologne, Germany | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* | ||
* Copyright holder is ArangoDB GmbH, Cologne, Germany | ||
*/ | ||
|
||
package com.arangodb.springframework.core.convert; | ||
|
||
import org.joda.time.DateTime; | ||
import org.joda.time.Instant; | ||
import org.joda.time.LocalDate; | ||
import org.joda.time.LocalDateTime; | ||
import org.joda.time.format.ISODateTimeFormat; | ||
|
||
public final class JodaTimeUtil { | ||
|
||
private JodaTimeUtil() { | ||
} | ||
|
||
public static String format(final Instant source) { | ||
return ISODateTimeFormat.dateTime().print(source); | ||
} | ||
|
||
public static String format(final DateTime source) { | ||
return ISODateTimeFormat.dateTime().print(source); | ||
} | ||
|
||
public static String format(final LocalDate source) { | ||
return ISODateTimeFormat.yearMonthDay().print(source); | ||
} | ||
|
||
public static String format(final LocalDateTime source) { | ||
return ISODateTimeFormat.dateTime().print(source); | ||
} | ||
|
||
public static Instant parseInstant(final String source) { | ||
return Instant.parse(source); | ||
} | ||
|
||
public static DateTime parseDateTime(final String source) { | ||
return DateTime.parse(source); | ||
} | ||
|
||
public static LocalDate parseLocalDate(final String source) { | ||
return LocalDate.parse(source); | ||
} | ||
|
||
public static LocalDateTime parseLocalDateTime(final String source) { | ||
return LocalDateTime.parse(source); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters