|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.cert.cc.util.Formatter
public class Formatter
Support for a macro for use in velocity to set fixed widths. Call setFieldLengths to initialize before using padField. Note: Not thread safe.
Constructor Summary | |
---|---|
Formatter()
|
Method Summary | |
---|---|
String |
pad(String string,
int width)
Pads the input string with spaces to the width specified. |
String |
padField(String fieldName,
String fieldValue)
Pads a field to a previously stored size set by setFieldLengths. |
String |
rightJustifyNumber(int number,
int width)
Right justifies the integer to the width specified. |
void |
setFieldLengths(Collection<String> fieldNames,
Collection<Issue> issues,
CustomFieldManager customFieldManager)
This method goes through all the field values for each field and finds the largest string to set the field width for formatting. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Formatter()
Method Detail |
---|
public String pad(String string, int width)
string
- - input stringwidth
- - width of output
public String rightJustifyNumber(int number, int width)
number
- - number to formatwidth
- - width to format the number to.
public String padField(String fieldName, String fieldValue)
fieldName
- - FieldName to look up for size.fieldValue
- - The value of the field to pad.
public void setFieldLengths(Collection<String> fieldNames, Collection<Issue> issues, CustomFieldManager customFieldManager)
fieldNames
- - Fields to record largest size for.issues
- - The issues to scan for the above fieldscustomFieldManager
- - CustomFieldManager
to allow handling of custom fields.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |