Top Description Fields Constructors Methods
java.time.format

public final Enum SignStyle

extends Enum<SignStyle>
Class Inheritance

Enumeration of ways to handle the positive/negative sign.

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.

Since
1.8

Field Summary

Modifier and TypeField 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.

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod 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[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

ALWAYSback 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_PADback 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.

NEVERback 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.

NORMALback 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_NEGATIVEback 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.

Constructor Detail

SignStyleback to summary
private SignStyle()

Method Detail

parseback to summary
pack-priv boolean parse(boolean positive, boolean strict, boolean fixedWidth)

Parse helper.

Parameters
positive:boolean

true if positive sign parsed, false for negative sign

strict:boolean

true if strict, false if lenient

fixedWidth:boolean

true if fixed width, false if not

valueOfback to summary
public static SignStyle valueOf(String name)
valuesback to summary
public static SignStyle[] values()