Class VariableFormatter

java.lang.Object
org.moeaframework.util.format.VariableFormatter
All Implemented Interfaces:
Formatter<Variable>

public class VariableFormatter extends Object implements Formatter<Variable>
Formatter for Variables. Primarily, this uses the registered formatter, if any, for numeric types.
  • Constructor Details

    • VariableFormatter

      public VariableFormatter(TabularData<?> data)
      Constructs a new variable formatter.
      Parameters:
      data - reference back to the tabular data object this formatter is associated, so it can call the TabularData.formatValue(Object) method on primitive types
  • Method Details

    • getType

      public Class<Variable> getType()
      Description copied from interface: Formatter
      Returns the class (or classes using inheritance) this formatter supports.
      Specified by:
      getType in interface Formatter<Variable>
      Returns:
      the class
    • format

      public String format(Object variable)
      Description copied from interface: Formatter
      Formats the given value into a string representation.
      Specified by:
      format in interface Formatter<Variable>
      Parameters:
      variable - the value
      Returns:
      the string representation