Class PositionalIndex


  • @API(EXPERIMENTAL)
    public class PositionalIndex
    extends java.lang.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
      PositionalIndex()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      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 Detail

      • PositionalIndex

        public PositionalIndex()
    • Method Detail

      • 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.