Package com.univocity.parsers.fixed
Enum FieldAlignment
- All Implemented Interfaces:
Serializable
,Comparable<FieldAlignment>
,java.lang.constant.Constable
Alignment of text in a fixed-width field.
- Author:
- Univocity Software Pty Ltd - parsers@univocity.com
-
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 TypeMethodDescriptionint
calculatePadding
(int totalLength, int lengthToWrite) Calculates how many whites paces to introduce before a value so it is printed as specified by the alignment type.static FieldAlignment
Returns the enum constant of this type with the specified name.static FieldAlignment[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
Enum Constant Details
-
LEFT
Aligns values to the left -
CENTER
Centralizes values -
RIGHT
Aligns values to the right
-
-
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
-
calculatePadding
public int calculatePadding(int totalLength, int lengthToWrite) Calculates how many whites paces to introduce before a value so it is printed as specified by the alignment type.- Parameters:
totalLength
- the total length available to write for a given fieldlengthToWrite
- the length of a value that will be written to the field- Returns:
- the number of whites paces to introduce in before the value to make it align as specified.
-