The formatting engine allows the positive and negative signs of numbers
to be controlled using this enum.
See DateTimeFormatterBuilder
for usage.
Implementation Specification
This is an immutable and thread-safe enum.
Modifier and Type | Field and Description |
---|---|
public static final SignStyle | ALWAYS
Style to always output the sign, where zero will output '+'. |
public static final SignStyle | EXCEEDS_PAD
Style to always output the sign if the value exceeds the pad width. |
public static final SignStyle | NEVER
Style to never output sign, only outputting the absolute value. |
public static final SignStyle | NORMAL
Style to output the sign only if the value is negative. |
public static final SignStyle | NOT_NEGATIVE
Style to block negative values, throwing an exception on printing. |
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
pack-priv boolean | parse(boolean
true if positive sign parsed, false for negative sign positive, boolean true if strict, false if lenient strict, boolean true if fixed width, false if not fixedWidth)Parse helper. |
public static SignStyle | |
public static SignStyle[] |
ALWAYS | back to summary |
---|---|
public static final SignStyle ALWAYS Style to always output the sign, where zero will output '+'. In strict parsing, the absence of a sign will be rejected. In lenient parsing, any sign will be accepted, with the absence of a sign treated as a positive number. |
EXCEEDS_PAD | back to summary |
---|---|
public static final SignStyle EXCEEDS_PAD Style to always output the sign if the value exceeds the pad width. A negative value will always output the '-' sign. In strict parsing, the sign will be rejected unless the pad width is exceeded. In lenient parsing, any sign will be accepted, with the absence of a sign treated as a positive number. |
NEVER | back to summary |
---|---|
public static final SignStyle NEVER Style to never output sign, only outputting the absolute value. In strict parsing, any sign will be rejected. In lenient parsing, any sign will be accepted unless the width is fixed. |
NORMAL | back to summary |
---|---|
public static final SignStyle NORMAL Style to output the sign only if the value is negative. In strict parsing, the negative sign will be accepted and the positive sign rejected. In lenient parsing, any sign will be accepted. |
NOT_NEGATIVE | back to summary |
---|---|
public static final SignStyle NOT_NEGATIVE Style to block negative values, throwing an exception on printing. In strict parsing, any sign will be rejected. In lenient parsing, any sign will be accepted unless the width is fixed. |
SignStyle | back to summary |
---|---|
private SignStyle() |
parse | back to summary |
---|---|
pack-priv boolean parse(boolean positive, boolean strict, boolean fixedWidth) Parse helper.
|
valueOf | back to summary |
---|---|
public static SignStyle valueOf(String name) |
values | back to summary |
---|---|
public static SignStyle[] values() |