Class PositiveIntegerColumn
java.lang.Object
io.github.kelsoncm.fwf.columns.AbstractColumn
io.github.kelsoncm.fwf.columns.PositiveIntegerColumn
- Direct Known Subclasses:
PositiveDecimalColumn
Positive integer column represented as a zero-padded string of digits.
-
Field Summary
Fields inherited from class AbstractColumn
description, name, size, start -
Constructor Summary
ConstructorsConstructorDescriptionPositiveIntegerColumn(String name, int size) Constructs a newPositiveIntegerColumnwith a name and size.PositiveIntegerColumn(String name, int size, String description) Constructs a newPositiveIntegerColumnwith a name, size, and description. -
Method Summary
Methods inherited from class AbstractColumn
getDescription, getEnd, getName, getSize, getStart, setStart, validateToStrSize
-
Constructor Details
-
PositiveIntegerColumn
-
PositiveIntegerColumn
Constructs a newPositiveIntegerColumnwith a name and size.- Parameters:
name- the column namesize- the column size in characters
-
-
Method Details
-
toValue
Converts a raw fixed-width zero-padded integer slice into an Integer value.- Overrides:
toValuein classAbstractColumn- Parameters:
slice- raw fixed-width substring- Returns:
- parsed integer value
- Throws:
IllegalArgumentException- ifsliceis not a valid non-negative integer
-
toStr
Formats a non-negative Number or null into a zero-padded string of exact column size.- Specified by:
toStrin classAbstractColumn- Parameters:
value- Number or null to format- Returns:
- zero-padded string of size
AbstractColumn.getSize() - Throws:
IllegalArgumentException- ifvalueis negative or not a valid number
-