-
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
5119905
commit 57155b9
Showing
12 changed files
with
151 additions
and
143 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
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
52 changes: 52 additions & 0 deletions
52
ion/src/main/java/tools/jackson/dataformat/ion/IonReadFeature.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,52 @@ | ||
package tools.jackson.dataformat.ion; | ||
|
||
import tools.jackson.core.FormatFeature; | ||
|
||
/** | ||
* Enumeration that defines all togglable features for Ion parsers. | ||
*<p> | ||
* NOTE: in Jackson 2.x this was named {@code IonParser.Feature}. | ||
*/ | ||
public enum IonReadFeature implements FormatFeature | ||
{ | ||
/** | ||
* Whether to expect Ion native Type Id construct for indicating type (true); | ||
* or "generic" type property (false) when deserializing. | ||
*<p> | ||
* Enabled by default. | ||
* | ||
* @see <a href="https://amzn.github.io/ion-docs/docs/spec.html#annot">The Ion Specification</a> | ||
*/ | ||
USE_NATIVE_TYPE_ID(true), | ||
; | ||
|
||
private final boolean _defaultState; | ||
private final int _mask; | ||
|
||
/** | ||
* Method that calculates bit set (flags) of all features that | ||
* are enabled by default. | ||
*/ | ||
public static int collectDefaults() | ||
{ | ||
int flags = 0; | ||
for (IonReadFeature f : values()) { | ||
if (f.enabledByDefault()) { | ||
flags |= f.getMask(); | ||
} | ||
} | ||
return flags; | ||
} | ||
|
||
private IonReadFeature(boolean defaultState) { | ||
_defaultState = defaultState; | ||
_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; } | ||
} |
Oops, something went wrong.