Class DBUtil

java.lang.Object
tripleplay.syncdb.DBUtil

public class DBUtil extends Object
SyncDB related utility methods.
  • Field Details

    • MAP_KEY_SEP

      public static final String MAP_KEY_SEP
      The separator used in a map key. This character must not appear in a normal key.
      See Also:
    • SUBDB_KEY_SEP

      public static final String SUBDB_KEY_SEP
      The separator used in a subdb key. This character may appear in a normal key, but if the client plans to manage subdb conflict resolution in the aggregate, it is best to avoid using this separator elsewhere.
      See Also:
  • Constructor Details

    • DBUtil

      public DBUtil()
  • Method Details

    • decodeSet

      public static <E> Set<E> decodeSet(String data, Codec<E> codec)
    • encodeSet

      public static <E> String encodeSet(Set<E> set, Codec<E> codec)
      Encodes the supplied set as a string, using the supplied codec for its elements. The encoded set uses \t to separate; that character should not appear in codec's output.
    • decodeList

      public static <E> List<E> decodeList(String data, Codec<E> codec)
    • encodeList

      public static <E> String encodeList(List<E> list, Codec<E> codec)
      Encodes the supplied list as a string, using the supplied codec for its elements. The encoded list uses \t to separate; that character should not appear in codec's output.
    • subDBKey

      public static String subDBKey(String prefix, String key)
      Computes the storage (fully qualified) key for the supplied subdb property key.
    • subDB

      public static String subDB(String fqKey)
      Extracts and returns the subdb prefix from the supplied fully-qualified key. Returns null if the supplied key is not a subdb key.
    • mapKey

      public static <K> String mapKey(String prefix, K key, Codec<K> codec)
      Computes the storage (fully qualified) key for the supplied map key.