Class PositionalIndex

java.lang.Object
com.apple.foundationdb.relational.util.PositionalIndex

@API(EXPERIMENTAL) public class PositionalIndex extends Object
The field positional offset/index is zero-based in protobuf but one-based in JDBC. Below is small utility for going between the different indexing modes.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static int
    toJDBC(int zeroBasedProtobufIndex)
    Adjust 'zeroBasedIndex' so can be used as a one-based JDBC index.
    static int
    toProtobuf(int oneBasedIndex)
    Adjust 'oneBasedIndex' so can be used as a zero-based protobuf index.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PositionalIndex

      public PositionalIndex()
  • Method Details

    • toProtobuf

      public static int toProtobuf(int oneBasedIndex)
      Adjust 'oneBasedIndex' so can be used as a zero-based protobuf index.
      Parameters:
      oneBasedIndex - JDBC indices are oneBased; i.e. first item is at postion 1.
      Returns:
      Protobuf index derived from oneBasedIndex.
    • toJDBC

      public static int toJDBC(int zeroBasedProtobufIndex)
      Adjust 'zeroBasedIndex' so can be used as a one-based JDBC index.
      Parameters:
      zeroBasedProtobufIndex - Protobuf zero-based index.
      Returns:
      An index that can be used on JDBC types.