Package com.deltaxml.core
Class DXPParameterDefinition.FormatInfo
java.lang.Object
com.deltaxml.core.DXPParameterDefinition.FormatInfo
- Enclosing class:
- DXPParameterDefinition<T extends Comparable<?>>
A utility class for identifying the space required to display a list of parameter definitions. This class assumes that the
width is directly proportional to the number of characters (such as in fixed width fonts).
- Author:
- anthonys
-
Constructor Summary
ConstructorsConstructorDescriptionFormatInfo(Iterable<? extends DXPParameterDefinition<?>> pars) Construct the fixed-width character format information associated with a list of parameter definitions. -
Method Summary
Modifier and TypeMethodDescriptionvoidappend(StringBuilder builder, int width, int indent) Append the parameter information in tabular form to a StringBuilder.intGet the width required to display the default value on a single line.intGet the minimum width required to display the default value whilst splitting lines on whitespace only.intGet the width required to display the description on a single line.intGet the width required to display the description whilst splitting lines on whitespace only.intgetMaxWidth(int seperation) Get the maximum width required to display all three columns.intgetMinWidth(int seperation) Get the minimum width required to display all three columns.intGet the width required to display the name on a single line.intGet the minimum width required to display the name whilst splitting lines on whitespace only.toString()Overrides the defaultequalsmethod.toString(int width, int indent) Returns a formatted String representation of parameters.
-
Constructor Details
-
FormatInfo
Construct the fixed-width character format information associated with a list of parameter definitions.- Parameters:
pars- The list of parameter definitions.
-
-
Method Details
-
getNameMinWidth
public int getNameMinWidth()Get the minimum width required to display the name whilst splitting lines on whitespace only.- Returns:
- The minimum width required to display the name whilst splitting lines on whitespace only.
-
getNameMaxWidth
public int getNameMaxWidth()Get the width required to display the name on a single line.- Returns:
- The width required to display the name on a single line.
-
getDefaultValueMinWidth
public int getDefaultValueMinWidth()Get the minimum width required to display the default value whilst splitting lines on whitespace only.- Returns:
- The minimum width required to display the default value whilst splitting lines on whitespace only.
-
getDefaultValueMaxWidth
public int getDefaultValueMaxWidth()Get the width required to display the default value on a single line.- Returns:
- The width required to display the default value on a single line.
-
getDescriptionMinWidth
public int getDescriptionMinWidth()Get the width required to display the description whilst splitting lines on whitespace only.- Returns:
- The width required to display the description whilst splitting lines on whitespace only
-
getDescriptionMaxWidth
public int getDescriptionMaxWidth()Get the width required to display the description on a single line.- Returns:
- The width required to display the description on a single line.
-
getMinWidth
public int getMinWidth(int seperation) Get the minimum width required to display all three columns.- Parameters:
seperation- The separation between the columns.- Returns:
- The minimum width to display all three columns.
-
getMaxWidth
public int getMaxWidth(int seperation) Get the maximum width required to display all three columns.- Parameters:
seperation- The separation between the columns.- Returns:
- The maximum width to display all three columns.
-
append
Append the parameter information in tabular form to a StringBuilder.- Parameters:
builder- The target StringBuilder.width- The maximum width of the table (not including an indent).indent- The number of spaces to prefix each output line by.
-
toString
Returns a formatted String representation of parameters.- Parameters:
width- the maximum width of the outputindent- an indent for the output string- Returns:
- a formatted String representation of parameters
-
toString
Overrides the defaultequalsmethod.Implemented as a call to
toString(int, int)with width 80 and indent 0
-