# Interface PolymorphicVariableFormatter

All Known Implementing Classes:
  `SmiManager`

public interface PolymorphicVariableFormatter
Defines a polymorphic variable formatter that is able to format a variable according to the given OID and row data using the currently configured available polymorphic `Variable` implementations. If no such implementation is available, the variable is formatted by the given `VariableTextFormat` implementation.

Since:
  2.0.0
Author:
  Frank Fock

- ## Method Summary

  Modifier and Type
  Method
  Description
  `PolymorphicColumnType`
  `addPolymorphicVariableTypeMapping(org.snmp4j.smi.OID typeColumnOID, PolymorphicColumnType polymorphicColumnType)`
  Adds a polymorphic variable type mapping.
  `String`
  `formatVariable(org.snmp4j.smi.OID oid, org.snmp4j.smi.Variable variable, List<? extends org.snmp4j.smi.VariableBinding> rowData, org.snmp4j.util.VariableTextFormat fallbackFormatter)`
  Formats a variable according to the given OID and row data using the currently configured available polymorphic `Variable` implementations.
  `PolymorphicColumnType`
  `removePolymorphicVariableTypeMapping(org.snmp4j.smi.OID variableColumnOID)`
  Removes a polymorphic variable type mapping.

- ## Method Details

  - ### formatVariable

    String formatVariable(org.snmp4j.smi.OID oid, org.snmp4j.smi.Variable variable, List<? extends org.snmp4j.smi.VariableBinding> rowData, org.snmp4j.util.VariableTextFormat fallbackFormatter)
    Formats a variable according to the given OID and row data using the currently configured available polymorphic `Variable` implementations. If no such implementation is available, the variable is formatted by the given `VariableTextFormat` implementation.
    Parameters:
      `oid` - the instance OID of the variable.
      `variable` - the variable to format.
      `rowData` - the `VariableBinding`s available of the same row where the variable is located. If there is another column that has been associated per configuration with this column `oid` and that column OID defines a polymorphic `Variable` type for this column, then this `variable` is formatted using the `VariableTextFormat` that is associated with the variable value of type-defining column.
      `fallbackFormatter` - the fallback formatter to use if no polymorphic implementation is available.
    Returns:
      the formatted variable.

  - ### addPolymorphicVariableTypeMapping

    PolymorphicColumnType addPolymorphicVariableTypeMapping(org.snmp4j.smi.OID typeColumnOID, PolymorphicColumnType polymorphicColumnType)
    Adds a polymorphic variable type mapping.
    Parameters:
      `typeColumnOID` - the OID of the column that defines the polymorphic variable type.
      `polymorphicColumnType` - the polymorphic variable type mapping.
    Returns:
      the previously registered polymorphic variable type mapping or `null` if there was no such mapping.

  - ### removePolymorphicVariableTypeMapping

    PolymorphicColumnType removePolymorphicVariableTypeMapping(org.snmp4j.smi.OID variableColumnOID)
    Removes a polymorphic variable type mapping.
    Parameters:
      `variableColumnOID` - the OID of the column that defines the polymorphic variable.
    Returns:
      the removed polymorphic variable type mapping.