Interface KastRow


  • public interface KastRow
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void clear()
      Clears all fields of this row.
      int getArity()
      Returns the number of fields in the row.
      Object getField​(int pos)
      Returns the field's content at the specified field position.
      Object getField​(String name)
      Returns the field's content using the specified field name.
      <T> T getFieldAs​(int pos)
      Returns the field's content at the specified field position.
      <T> T getFieldAs​(String name)
      Returns the field's content using the specified field name.
      Set<String> getFieldNames​(boolean includeNamedPositions)
      Returns the set of field names if this row operates in name-based field mode, otherwise null.
      KastRowKind getKind()
      Returns the kind of change that this row describes in a changelog.
      void setField​(int pos, Object value)
      Sets the field's content at the specified position.
      void setField​(String name, Object value)
      Sets the field's content using the specified field name.
      void setKind​(KastRowKind kind)
      Sets the kind of change that this row describes in a changelog.
    • Method Detail

      • getArity

        int getArity()
        Returns the number of fields in the row.

        Note: The row kind is kept separate from the fields and is not included in this number.

        Returns:
        the number of fields in the row
      • getField

        @Nullable
        Object getField​(int pos)
        Returns the field's content at the specified field position.

        Note: The row must operate in position-based field mode.

        Parameters:
        pos - the position of the field, 0-based
        Returns:
        the field's content at the specified position
      • getFieldAs

        <T> T getFieldAs​(int pos)
        Returns the field's content at the specified field position.

        Note: The row must operate in position-based field mode.

        This method avoids a lot of manual casting in the user implementation.

        Parameters:
        pos - the position of the field, 0-based
        Returns:
        the field's content at the specified position
      • getField

        @Nullable
        Object getField​(String name)
        Returns the field's content using the specified field name.

        Note: The row must operate in name-based field mode.

        Parameters:
        name - the name of the field or null if not set previously
        Returns:
        the field's content
      • getFieldAs

        <T> T getFieldAs​(String name)
        Returns the field's content using the specified field name.

        Note: The row must operate in name-based field mode.

        This method avoids a lot of manual casting in the user implementation.

        Parameters:
        name - the name of the field, set previously
        Returns:
        the field's content
      • setField

        void setField​(int pos,
                      @Nullable
                      Object value)
        Sets the field's content at the specified position.

        Note: The row must operate in position-based field mode.

        Parameters:
        pos - the position of the field, 0-based
        value - the value to be assigned to the field at the specified position
      • setField

        void setField​(String name,
                      @Nullable
                      Object value)
        Sets the field's content using the specified field name.

        Note: The row must operate in name-based field mode.

        Parameters:
        name - the name of the field
        value - the value to be assigned to the field
      • getFieldNames

        @Nullable
        Set<String> getFieldNames​(boolean includeNamedPositions)
        Returns the set of field names if this row operates in name-based field mode, otherwise null.

        This method is a helper method for serializers and converters but can also be useful for other row transformations.

        Parameters:
        includeNamedPositions - whether or not to include named positions when this row operates in a hybrid field mode
      • clear

        void clear()
        Clears all fields of this row.