public final class JacksonFeatureSet<F extends JacksonFeature> extends Object
EnumSet meant for storing sets of
JacksonFeatures (usually Enums): main
difference being that these sets are immutable. Also only supports relatively
small sets of features: specifically, up to 31 features.| Modifier and Type | Field and Description |
|---|---|
protected int |
_enabled |
| Modifier | Constructor and Description |
|---|---|
protected |
JacksonFeatureSet(int bitmask)
Constructor for creating instance with specific bitmask, wherein
1 bit means matching JacksonFeature is enabled and
0 disabled. |
| Modifier and Type | Method and Description |
|---|---|
int |
asBitmask()
Accessor for underlying bitmask
|
static <F extends JacksonFeature> |
fromBitmask(int bitmask) |
static <F extends JacksonFeature> |
fromDefaults(F[] allFeatures)
"Default" factory which will calculate settings based on default-enabled
status of all features.
|
boolean |
isEnabled(F feature)
Main accessor for checking whether given feature is enabled in this feature set.
|
JacksonFeatureSet<F> |
with(F feature)
Mutant factory for getting a set in which specified feature is enabled:
will either return this instance (if no change), or newly created set (if there
is change).
|
JacksonFeatureSet<F> |
without(F feature)
Mutant factory for getting a set in which specified feature is disabled:
will either return this instance (if no change), or newly created set (if there
is change).
|
protected JacksonFeatureSet(int bitmask)
1 bit means matching JacksonFeature is enabled and
0 disabled.bitmask - Bitmask for features that are enabledpublic static <F extends JacksonFeature> JacksonFeatureSet<F> fromDefaults(F[] allFeatures)
F - Self-reference type for convenienceallFeatures - Set of all features (enabled or disabled): usually from
Enum.values()public static <F extends JacksonFeature> JacksonFeatureSet<F> fromBitmask(int bitmask)
public JacksonFeatureSet<F> with(F feature)
feature - Feature to enable in set returnedthis if notpublic JacksonFeatureSet<F> without(F feature)
feature - Feature to disable in set returnedthis if notpublic boolean isEnabled(F feature)
feature - Feature to checkpublic int asBitmask()
Copyright © 2008–2021 FasterXML. All rights reserved.