APIdia Launch Partner
Top Description Fields Constructors Methods
java.time.format

public final Enum TextStyle

extends Enum<TextStyle>
Class Inheritance
Imports
java.util.Calendar

Enumeration of the style of text formatting and parsing.

Text styles define three sizes for the formatted text - 'full', 'short' and 'narrow'. Each of these three sizes is available in both 'standard' and 'stand-alone' variations.

The difference between the three sizes is obvious in most languages. For example, in English the 'full' month is 'January', the 'short' month is 'Jan' and the 'narrow' month is 'J'. Note that the narrow size is often not unique. For example, 'January', 'June' and 'July' all have the 'narrow' text 'J'.

The difference between the 'standard' and 'stand-alone' forms is trickier to describe as there is no difference in English. However, in other languages there is a difference in the word used when the text is used alone, as opposed to in a complete date. For example, the word used for a month when used alone in a date picker is different to the word used for month in association with a day and year in a date.

Implementation Specification

This is an immutable and thread-safe enum.

Since
1.8

Field Summary

Modifier and TypeField and Description
private final int
public static final TextStyle
FULL

Full text, typically the full description.

public static final TextStyle
FULL_STANDALONE

Full text for stand-alone use, typically the full description.

public static final TextStyle
NARROW

Narrow text, typically a single letter.

public static final TextStyle
NARROW_STANDALONE

Narrow text for stand-alone use, typically a single letter.

public static final TextStyle
SHORT

Short text, typically an abbreviation.

public static final TextStyle
SHORT_STANDALONE

Short text for stand-alone use, typically an abbreviation.

private final int

Constructor Summary

AccessConstructor and Description
private
TextStyle(int calendarStyle, int zoneNameStyleIndex)

Method Summary

Modifier and TypeMethod and Description
public TextStyle

Returns:

the normal style with the same size
asNormal
()

Returns the normal style with the same size.

public TextStyle

Returns:

the stand-alone style with the same size
asStandalone
()

Returns the stand-alone style with the same size.

public boolean

Returns:

true if the style is a stand-alone style.
isStandalone
()

Returns true if the Style is a stand-alone style.

pack-priv int

Returns:

the corresponding Calendar style
toCalendarStyle
()

Returns the Calendar style corresponding to this TextStyle.

public static TextStyle
public static TextStyle[]
pack-priv int

Returns:

the relative index value to time zone names array
zoneNameStyleIndex
()

Returns the relative index value to an element of the DateFormatSymbols.getZoneStrings() value, 0 for long names and 1 for short names (abbreviations).

Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

calendarStyleback to summary
private final int calendarStyle
FULLback to summary
public static final TextStyle FULL

Full text, typically the full description. For example, day-of-week Monday might output "Monday".

FULL_STANDALONEback to summary
public static final TextStyle FULL_STANDALONE

Full text for stand-alone use, typically the full description. For example, day-of-week Monday might output "Monday".

NARROWback to summary
public static final TextStyle NARROW

Narrow text, typically a single letter. For example, day-of-week Monday might output "M".

NARROW_STANDALONEback to summary
public static final TextStyle NARROW_STANDALONE

Narrow text for stand-alone use, typically a single letter. For example, day-of-week Monday might output "M".

SHORTback to summary
public static final TextStyle SHORT

Short text, typically an abbreviation. For example, day-of-week Monday might output "Mon".

SHORT_STANDALONEback to summary
public static final TextStyle SHORT_STANDALONE

Short text for stand-alone use, typically an abbreviation. For example, day-of-week Monday might output "Mon".

zoneNameStyleIndexback to summary
private final int zoneNameStyleIndex

Constructor Detail

TextStyleback to summary
private TextStyle(int calendarStyle, int zoneNameStyleIndex)

Method Detail

asNormalback to summary
public TextStyle asNormal()

Returns the normal style with the same size.

Returns:TextStyle

the normal style with the same size

asStandaloneback to summary
public TextStyle asStandalone()

Returns the stand-alone style with the same size.

Returns:TextStyle

the stand-alone style with the same size

isStandaloneback to summary
public boolean isStandalone()

Returns true if the Style is a stand-alone style.

Returns:boolean

true if the style is a stand-alone style.

toCalendarStyleback to summary
pack-priv int toCalendarStyle()

Returns the Calendar style corresponding to this TextStyle.

Returns:int

the corresponding Calendar style

valueOfback to summary
public static TextStyle valueOf(String name)
valuesback to summary
public static TextStyle[] values()
zoneNameStyleIndexback to summary
pack-priv int zoneNameStyleIndex()

Returns the relative index value to an element of the DateFormatSymbols.getZoneStrings() value, 0 for long names and 1 for short names (abbreviations). Note that these values do not correspond to the java.util.TimeZone#LONG and java.util.TimeZone#SHORT values.

Returns:int

the relative index value to time zone names array