Top Description Fields Constructors Methods
com.fasterxml.jackson.core.util

public final Class JacksonFeatureSet<F extends JacksonFeature>

extends Object
implements Serializable
Class Inheritance
All Implemented Interfaces
java.io.Serializable

Container similar to java.util.EnumSet meant for storing sets of JacksonFeatures (usually java.lang.Enums): main difference being that these sets are immutable. Also only supports relatively small sets of features: specifically, up to 31 features.
Since
2.12

Field Summary

Modifier and TypeField and Description
protected int
private static final long

Constructor Summary

AccessConstructor and Description
protected
JacksonFeatureSet(int
Bitmask for features that are enabled
bitmask
)

Constructor for creating instance with specific bitmask, wherein 1 bit means matching JacksonFeature is enabled and 0 disabled.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

Bitmask of enabled features
asBitmask
()

Accessor for underlying bitmask

public static <F extends JacksonFeature> JacksonFeatureSet<F>
fromBitmask(int bitmask)

public static <
Self-reference type for convenience
F extends JacksonFeature
>
JacksonFeatureSet<F>

Returns:

Feature set instance constructed
fromDefaults
(F[]
Set of all features (enabled or disabled): usually from Enum.values()
allFeatures
)

"Default" factory which will calculate settings based on default-enabled status of all features.

public boolean

Returns:

True if feature is enabled in this set; false otherwise
isEnabled
(F
Feature to check
feature
)

Main accessor for checking whether given feature is enabled in this feature set.

public JacksonFeatureSet<F>

Returns:

Newly created set of state of feature changed; this if not
with
(F
Feature to enable in set returned
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).

public JacksonFeatureSet<F>

Returns:

Newly created set of state of feature changed; this if not
without
(F
Feature to disable in set returned
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).

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_enabledback to summary
protected int _enabled
serialVersionUIDback to summary
private static final long serialVersionUID

Constructor Detail

JacksonFeatureSetback to summary
protected JacksonFeatureSet(int bitmask)

Constructor for creating instance with specific bitmask, wherein 1 bit means matching JacksonFeature is enabled and 0 disabled.

Parameters
bitmask:int

Bitmask for features that are enabled

Method Detail

asBitmaskback to summary
public int asBitmask()

Accessor for underlying bitmask

Returns:int

Bitmask of enabled features

fromBitmaskback to summary
public static <F extends JacksonFeature> JacksonFeatureSet<F> fromBitmask(int bitmask)
fromDefaultsback to summary
public static <F extends JacksonFeature> JacksonFeatureSet<F> fromDefaults(F[] allFeatures)

"Default" factory which will calculate settings based on default-enabled status of all features.

Parameters
<F>
Self-reference type for convenience
allFeatures:F[]

Set of all features (enabled or disabled): usually from Enum.values()

Returns:JacksonFeatureSet<F>

Feature set instance constructed

isEnabledback to summary
public boolean isEnabled(F feature)

Main accessor for checking whether given feature is enabled in this feature set.

Parameters
feature:F

Feature to check

Returns:boolean

True if feature is enabled in this set; false otherwise

withback to summary
public 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).

Parameters
feature:F

Feature to enable in set returned

Returns:JacksonFeatureSet<F>

Newly created set of state of feature changed; this if not

withoutback to summary
public 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).

Parameters
feature:F

Feature to disable in set returned

Returns:JacksonFeatureSet<F>

Newly created set of state of feature changed; this if not