Package org.javacord.api.entity.message
Enum TimestampStyle
- java.lang.Object
-
- java.lang.Enum<TimestampStyle>
-
- org.javacord.api.entity.message.TimestampStyle
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<TimestampStyle>
public enum TimestampStyle extends java.lang.Enum<TimestampStyle>
The enum contains all different types of timestamp styles.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description LONG_DATEDisplayed as: 20 April 2021.LONG_DATE_TIMEDisplayed as: Tuesday, 20 April 2021 16:20.LONG_TIMEDisplayed as: 16:20:30.RELATIVE_TIMEDisplayed as: 2 months ago.SHORT_DATEDisplayed as: 20/04/2021.SHORT_DATE_TIMEDisplayed as: 20 April 2021 16:20.SHORT_TIMEDisplayed as: 16:20.UNKNOWNAn unknown timestamp style.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TimestampStylebyStyle(java.lang.String timestampStyle)Gets the type by its int representation.java.lang.StringgetTimestampStyle()Gets the timestamp style name.java.lang.StringgetTimestampTag(long epochSeconds)Gets the timestamp tag used in messages.java.lang.StringgetTimestampTag(java.time.Instant instant)Gets the timestamp tag used in messages.static TimestampStylevalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static TimestampStyle[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
SHORT_TIME
public static final TimestampStyle SHORT_TIME
Displayed as: 16:20.
-
LONG_TIME
public static final TimestampStyle LONG_TIME
Displayed as: 16:20:30.
-
SHORT_DATE
public static final TimestampStyle SHORT_DATE
Displayed as: 20/04/2021.
-
LONG_DATE
public static final TimestampStyle LONG_DATE
Displayed as: 20 April 2021.
-
SHORT_DATE_TIME
public static final TimestampStyle SHORT_DATE_TIME
Displayed as: 20 April 2021 16:20.
-
LONG_DATE_TIME
public static final TimestampStyle LONG_DATE_TIME
Displayed as: Tuesday, 20 April 2021 16:20.
-
RELATIVE_TIME
public static final TimestampStyle RELATIVE_TIME
Displayed as: 2 months ago.
-
UNKNOWN
public static final TimestampStyle UNKNOWN
An unknown timestamp style.
-
-
Method Detail
-
values
public static TimestampStyle[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (TimestampStyle c : TimestampStyle.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static TimestampStyle valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
byStyle
public static TimestampStyle byStyle(java.lang.String timestampStyle)
Gets the type by its int representation.- Parameters:
timestampStyle- The String representation.- Returns:
- The timestamp style.
-
getTimestampStyle
public java.lang.String getTimestampStyle()
Gets the timestamp style name.- Returns:
- The name of the timestamp style.
-
getTimestampTag
public java.lang.String getTimestampTag(long epochSeconds)
Gets the timestamp tag used in messages.- Parameters:
epochSeconds- The epoch seconds of the timestamp.- Returns:
- The tag of the timestamp.
-
getTimestampTag
public java.lang.String getTimestampTag(java.time.Instant instant)
Gets the timestamp tag used in messages.- Parameters:
instant- An instant of the time that should be displayed with this timestamp.- Returns:
- The tag of the timestamp.
-
-