Package com.unboundid.util
Enum HorizontalAlignment
- All Implemented Interfaces:
Serializable,Comparable<HorizontalAlignment>,java.lang.constant.Constable
@ThreadSafety(level=COMPLETELY_THREADSAFE)
public enum HorizontalAlignment
extends Enum<HorizontalAlignment>
This enumeration defines a set of values that may indicate how text should be
horizontally aligned.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionvoidformat(StringBuilder buffer, String text, int width) Appends the provided string to the given buffer, aligned properly within the specified width.static HorizontalAlignmentRetrieves the horizontal alignment value with the specified name.static HorizontalAlignmentReturns the enum constant of this type with the specified name.static HorizontalAlignment[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
LEFT
Indicates that items should be aligned along their left edges. -
CENTER
Indicates that text should be aligned along their centers. -
RIGHT
Indicates that text should be aligned along right edges.
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
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:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
format
Appends the provided string to the given buffer, aligned properly within the specified width. Spaces will be inserted before and/or after the text as necessary to achieve the desired alignment. This method will always append exactlywidthcharacters (including spaces added to achieve the desired alignment) to the provided buffer. If the given text is longer thanwidth, then only the firstwidthcharacters of the provided text will be appended.- Parameters:
buffer- The buffer to which the formatted text should be appended. It must not benull.text- The text to be added to the provided buffer, with additional spaces as necessary to achieve the desired width. It must not benull.width- The number of characters to append to the provided buffer. It must be greater than or equal to 1.
-
forName
Retrieves the horizontal alignment value with the specified name.- Parameters:
name- The name of the horizontal alignment value to retrieve. It must not benull.- Returns:
- The requested horizontal alignment value, or
nullif no such value is defined.
-