Enum Class BitSetFormat
- All Implemented Interfaces:
Serializable,Comparable<BitSetFormat>,Constable
BitSet values.
Used by MarshallingContext.Builder.bitSetFormat(BitSetFormat),
Marshalled.bitSetFormat(),
MarshalledProp.bitSetFormat(), and
MarshalledConfig.bitSetFormat() to control how BitSet values
are written to text-based wire formats.
The default is INDICES which emits the ascending set-bit indices as a comma-delimited token.
Precedence (highest to lowest)
@MarshalledProp(bitSetFormat=…)on the bean property.@Marshalled(bitSetFormat=…)on the bean class.@MarshalledConfig(bitSetFormat=…)on-annotated classes / methods.@Rest - Programmatic
MarshallingContext.Builder.bitSetFormat(BitSetFormat). - Environment variable
MarshallingContext.bitSetFormat . - The default constant (
INDICES).
Parsing
Parsing is directed by the configured constant — a serializer and parser sharing the same
BitSetFormat round-trip cleanly. The three textual shapes are ambiguous with each other
(a bare digit string is a valid index list, bit string, and hex token), so the configured format is
honored rather than auto-detected.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum ConstantsEnum ConstantDescriptionLittle-endian bit string — character at positioni is'1' when biti is set.Hex-encoded little-endian byte array (BitSet.toByteArray()).Ascending set-bit indices as a comma-delimited token (the default).Sentinel meaning "no value configured" — falls through to the next-higher precedence level. -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringformat(BitSet value, BitSetFormat format) Formats the specifiedBitSetusing this format.booleanReturnstrue if this format is numeric on the wire.static BitSetparse(String value, BitSetFormat format) Parses the specified wire value into aBitSet.static BitSetFormatReturns the enum constant of this class with the specified name.static BitSetFormat[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
NOT_SET
Sentinel meaning "no value configured" — falls through to the next-higher precedence level. -
INDICES
Ascending set-bit indices as a comma-delimited token (the default).Example:
0,2,5
An empty
BitSetemits the empty string. -
BITS
Little-endian bit string — character at positioni is'1' when biti is set.Example:
101001
The string length equals
BitSet.length(); an emptyBitSetemits the empty string. -
HEX
Hex-encoded little-endian byte array (BitSet.toByteArray()).Example:
25
An empty
BitSetemits the empty string.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
format
- Parameters:
value- The value to format. Can benull (returnsnull ).format- The format to use. Can benull (treated asINDICES).- Returns:
- The formatted wire representation, or
null ifvalueisnull .
-
parse
Parses the specified wire value into aBitSet.Parsing is directed by the
formathint (defaulting toINDICES); the three textual shapes are mutually ambiguous, so the configured format is honored rather than auto-detected.- Parameters:
value- The wire value. Can benull (returnsnull ) or blank (returns an emptyBitSet).format- The configured format hint. Can benull (treated asINDICES).- Returns:
- The parsed
BitSet, ornull ifvalueisnull . - Throws:
IllegalArgumentException- If the value does not match the configured textual shape.
-
isNumeric
Returnstrue if this format is numeric on the wire.Always
false — every constant emits a textual representation.- Returns:
false .
-