Class DefaultMOTableRow

java.lang.Object
org.snmp4j.agent.mo.DefaultMOTableRow
All Implemented Interfaces:
Comparable<MOTableRow>, MOTableRow
Direct Known Subclasses:
DefaultMOMutableRow2PC

public class DefaultMOTableRow extends Object implements MOTableRow, Comparable<MOTableRow>
The DefaultMOTableRow is the default table row implementation. Instances are compared by their index value. The base row reference is not supported, since the default row implementation is designed for read-only tables. For mutable rows, use instances implementing the MOMutableTableRow interface.
Version:
3.3.1
Author:
Frank Fock
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.snmp4j.smi.OID
     
    protected org.snmp4j.smi.Variable[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    DefaultMOTableRow(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] values)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compares this row with a MOTableRow instance by their index values.
    boolean
     
    Gets the associated base row for this row (if this row is a dependent row).
    static <V extends org.snmp4j.smi.Variable>
    V
    getColumnValue(MOTableRow row, MOTable<?,?,?> table, Class<MOColumn<V>> columnClass, SubRequest<?> subRequest)
    Gets the value of the first column (if it exists) in the specified row and table that matches (equals) the given column class.
    org.snmp4j.smi.OID
    Gets the row's index OID, for example the row index of the first row of an ifTable would return OID("1").
    org.snmp4j.smi.Variable
    getValue(int column)
    Gets the value at the specified column index.
    int
     
    void
    Sets the associated base row.
    int
    Returns the number of columns in this row.
     
    protected String
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • values

      protected org.snmp4j.smi.Variable[] values
    • index

      protected org.snmp4j.smi.OID index
  • Constructor Details

    • DefaultMOTableRow

      public DefaultMOTableRow(org.snmp4j.smi.OID index, org.snmp4j.smi.Variable[] values)
  • Method Details

    • getBaseRow

      public MOTableRow getBaseRow()
      Description copied from interface: MOTableRow
      Gets the associated base row for this row (if this row is a dependent row).
      Specified by:
      getBaseRow in interface MOTableRow
      Returns:
      the base row or null if this row is a base row itself.
    • getIndex

      public org.snmp4j.smi.OID getIndex()
      Description copied from interface: MOTableRow
      Gets the row's index OID, for example the row index of the first row of an ifTable would return OID("1").
      Specified by:
      getIndex in interface MOTableRow
      Returns:
      the row index of this row.
    • getValue

      public org.snmp4j.smi.Variable getValue(int column)
      Description copied from interface: MOTableRow
      Gets the value at the specified column index.
      Specified by:
      getValue in interface MOTableRow
      Parameters:
      column - the zero-based column index.
      Returns:
      the value at the specified index.
    • size

      public int size()
      Description copied from interface: MOTableRow
      Returns the number of columns in this row.
      Specified by:
      size in interface MOTableRow
      Returns:
      the column count.
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toStringMembers

      protected String toStringMembers()
    • setBaseRow

      public void setBaseRow(MOTableRow baseRow)
      Description copied from interface: MOTableRow
      Sets the associated base row.
      Specified by:
      setBaseRow in interface MOTableRow
      Parameters:
      baseRow - the base row.
    • compareTo

      public int compareTo(MOTableRow o)
      Compares this row with a MOTableRow instance by their index values.
      Specified by:
      compareTo in interface Comparable<MOTableRow>
      Parameters:
      o - a MOTableRow instance
      Returns:
      getIndex().compareTo(o.getIndex())
    • getColumnValue

      public static <V extends org.snmp4j.smi.Variable> V getColumnValue(MOTableRow row, MOTable<?,?,?> table, Class<MOColumn<V>> columnClass, SubRequest<?> subRequest)
      Gets the value of the first column (if it exists) in the specified row and table that matches (equals) the given column class. It starts searching for the column from the first column and then proceeds last until it finds it. If no matching column can be found, null is returned.
      Type Parameters:
      V - the value (Variable) class for this column.
      Parameters:
      row - a row with a RowStatus column (otherwise null is returned).
      table - the table of the given row.
      columnClass - the class of the column object.
      subRequest - an optional sub-request on which behalf this value retrieval is executed.
      Returns:
      the value of the matched column in the given row or null if the table has no column with the specified column class.
      Since:
      3.3.1