-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Move jackson-datatype-jsr310
into jackson-databind
#5032
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
Changes from 18 commits
9744808
0141457
b25ee25
615f6f2
e5b0263
e586ec5
70d3194
d47a0e9
c78b6cb
67e4154
30b97d8
1393821
27ef8b7
0dd3dfc
1be24ec
27bafa4
e8c7c99
3d39a7f
f4325b7
6f43389
d6d8d04
0f8a890
6432627
6e25e80
765ca83
c5ffdd8
53303b9
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 |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package tools.jackson.databind.ext.datetime; | ||
|
||
import tools.jackson.core.util.JacksonFeature; | ||
|
||
/** | ||
* Configurable on/off features for Java 8 Date/Time module ({@link JavaTimeInitializer}). | ||
* | ||
* @since 2.16 | ||
*/ | ||
public enum JavaTimeFeature implements JacksonFeature | ||
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. If possible, I think we should actually change the idea here to create new It would contain entries we have here, initially, but then see if we could move existing This would then be a building block for https://github.com/FasterXML/jackson-future-ideas/wiki/JSTEP-5 Finally, renamed |
||
{ | ||
/** | ||
* Feature that determines whether {@link java.time.ZoneId} is normalized | ||
* (via call to {@code java.time.ZoneId#normalized()}) when deserializing | ||
* types like {@link java.time.ZonedDateTime}. | ||
*<p> | ||
* Default setting is enabled, for backwards-compatibility with | ||
* Jackson 2.15. | ||
*/ | ||
NORMALIZE_DESERIALIZED_ZONE_ID(true), | ||
|
||
/** | ||
* Feature that determines whether the {@link java.util.TimeZone} of the | ||
* {@link tools.jackson.databind.DeserializationContext} is used | ||
* when leniently deserializing {@link java.time.LocalDate} or | ||
* {@link java.time.LocalDateTime} from the UTC/ISO instant format. | ||
* <p> | ||
* Default setting is disabled, for backwards-compatibility with | ||
* Jackson 2.18. | ||
* | ||
* @since 2.19 | ||
*/ | ||
USE_TIME_ZONE_FOR_LENIENT_DATE_PARSING(false), | ||
|
||
/** | ||
* Feature that controls whether stringified numbers (Strings that without | ||
* quotes would be legal JSON Numbers) may be interpreted as | ||
* timestamps (enabled) or not (disabled), in case where there is an | ||
* explicitly defined pattern ({@code DateTimeFormatter}) for value. | ||
* <p> | ||
* Note that when the default pattern is used (no custom pattern defined), | ||
* stringified numbers are always accepted as timestamps regardless of | ||
* this feature. | ||
*/ | ||
ALWAYS_ALLOW_STRINGIFIED_DATE_TIMESTAMPS(false), | ||
|
||
/** | ||
* Feature that determines whether {@link java.time.Month} is serialized | ||
* and deserialized as using a zero-based index (FALSE) or a one-based index (TRUE). | ||
* For example, "1" would be serialized/deserialized as Month.JANUARY if TRUE and Month.FEBRUARY if FALSE. | ||
*<p> | ||
* Default setting is false, meaning that Month is serialized/deserialized as a zero-based index. | ||
*/ | ||
ONE_BASED_MONTHS(false) | ||
; | ||
|
||
/** | ||
* Whether feature is enabled or disabled by default. | ||
*/ | ||
private final boolean _defaultState; | ||
|
||
private final int _mask; | ||
|
||
JavaTimeFeature(boolean enabledByDefault) { | ||
_defaultState = enabledByDefault; | ||
_mask = (1 << ordinal()); | ||
} | ||
|
||
@Override | ||
public boolean enabledByDefault() { return _defaultState; } | ||
|
||
@Override | ||
public boolean enabledIn(int flags) { return (flags & _mask) != 0; } | ||
|
||
@Override | ||
public int getMask() { return _mask; } | ||
} |
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.
Ahhhh. Ok, here's something we'll need to change: new
JavaTimeFeature
(or eventualDateTimeFeature
) can and should be added as 3rd thing inDatatypeFeatures
(along withEnumFeature
andJsonNodeFeature
) -- it's designed to be extended.I can do that tomorrow.