-
-
Notifications
You must be signed in to change notification settings - Fork 796
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be5af88
commit 3440c73
Showing
5 changed files
with
119 additions
and
1 deletion.
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
55 changes: 55 additions & 0 deletions
55
src/main/java/com/fasterxml/jackson/core/StreamWriteCapability.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,55 @@ | ||
package com.fasterxml.jackson.core; | ||
|
||
import com.fasterxml.jackson.core.util.JacksonFeature; | ||
|
||
/** | ||
* Set of on/off capabilities that a {@link JsonGenerator} for given format | ||
* (or in case of buffering, original format) has. | ||
* Used in some cases to adjust aspects of things like content conversions and | ||
* coercions by format-agnostic functionality. | ||
* Specific or expected usage documented by individual capability entry Javadocs. | ||
* | ||
* @since 2.12 | ||
*/ | ||
public enum StreamWriteCapability | ||
implements JacksonFeature | ||
{ | ||
/** | ||
* Capability that indicates that the data format is able to express binary | ||
* data natively, without using textual encoding like Base64. | ||
*<p> | ||
* Capability is currently enabled for all binary formats and none of textual | ||
* formats. | ||
*/ | ||
CAN_WRITE_BINARY_NATIVELY(false), | ||
|
||
/** | ||
* Capability that indicates that the data format is able to write | ||
* "formatted numbers": that is, output of numbers is done as Strings | ||
* and caller is allowed to pass in logical number values as Strings. | ||
*<p> | ||
* Capability is currently enabled for most textual formats and none of binary | ||
* formats. | ||
*/ | ||
CAN_WRITE_FORMATTED_NUMBERS(false) | ||
; | ||
|
||
/** | ||
* Whether feature is enabled or disabled by default. | ||
*/ | ||
private final boolean _defaultState; | ||
|
||
private final int _mask; | ||
|
||
private StreamWriteCapability(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; } | ||
} |
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