Class TypeTokens

java.lang.Object
org.apache.cassandra.cql3.functions.types.TypeTokens

public final class TypeTokens extends Object
Utility methods to create TypeToken instances.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> com.google.common.reflect.TypeToken<List<T>>
    listOf(com.google.common.reflect.TypeToken<T> eltType)
    Create a TypeToken that represents a List whose elements are of the given type.
    static <T> com.google.common.reflect.TypeToken<List<T>>
    listOf(Class<T> eltType)
    Create a TypeToken that represents a List whose elements are of the given type.
    static <K, V> com.google.common.reflect.TypeToken<Map<K,V>>
    mapOf(com.google.common.reflect.TypeToken<K> keyType, com.google.common.reflect.TypeToken<V> valueType)
    Create a TypeToken that represents a Map whose keys and values are of the given key and value types.
    static <K, V> com.google.common.reflect.TypeToken<Map<K,V>>
    mapOf(Class<K> keyType, Class<V> valueType)
    Create a TypeToken that represents a Map whose keys and values are of the given key and value types.
    static <T> com.google.common.reflect.TypeToken<Set<T>>
    setOf(com.google.common.reflect.TypeToken<T> eltType)
    Create a TypeToken that represents a Set whose elements are of the given type.
    static <T> com.google.common.reflect.TypeToken<Set<T>>
    setOf(Class<T> eltType)
    Create a TypeToken that represents a Set whose elements are of the given type.
    static <T> com.google.common.reflect.TypeToken<List<T>>
    vectorOf(com.google.common.reflect.TypeToken<T> eltType)
    Create a TypeToken that represents a TypeToken whose elements are of the given type.

    Methods inherited from class java.lang.Object

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

    • listOf

      public static <T> com.google.common.reflect.TypeToken<List<T>> listOf(Class<T> eltType)
      Create a TypeToken that represents a List whose elements are of the given type.
      Type Parameters:
      T - The list element type.
      Parameters:
      eltType - The list element type.
      Returns:
      A TypeToken that represents a List whose elements are of the given type.
    • listOf

      public static <T> com.google.common.reflect.TypeToken<List<T>> listOf(com.google.common.reflect.TypeToken<T> eltType)
      Create a TypeToken that represents a List whose elements are of the given type.
      Type Parameters:
      T - The list element type.
      Parameters:
      eltType - The list element type.
      Returns:
      A TypeToken that represents a List whose elements are of the given type.
    • setOf

      public static <T> com.google.common.reflect.TypeToken<Set<T>> setOf(Class<T> eltType)
      Create a TypeToken that represents a Set whose elements are of the given type.
      Type Parameters:
      T - The set element type.
      Parameters:
      eltType - The set element type.
      Returns:
      A TypeToken that represents a Set whose elements are of the given type.
    • setOf

      public static <T> com.google.common.reflect.TypeToken<Set<T>> setOf(com.google.common.reflect.TypeToken<T> eltType)
      Create a TypeToken that represents a Set whose elements are of the given type.
      Type Parameters:
      T - The set element type.
      Parameters:
      eltType - The set element type.
      Returns:
      A TypeToken that represents a Set whose elements are of the given type.
    • mapOf

      public static <K, V> com.google.common.reflect.TypeToken<Map<K,V>> mapOf(Class<K> keyType, Class<V> valueType)
      Create a TypeToken that represents a Map whose keys and values are of the given key and value types.
      Type Parameters:
      K - The map key type.
      V - The map value type
      Parameters:
      keyType - The map key type.
      valueType - The map value type
      Returns:
      A TypeToken that represents a Map whose keys and values are of the given key and value types
    • mapOf

      public static <K, V> com.google.common.reflect.TypeToken<Map<K,V>> mapOf(com.google.common.reflect.TypeToken<K> keyType, com.google.common.reflect.TypeToken<V> valueType)
      Create a TypeToken that represents a Map whose keys and values are of the given key and value types.
      Type Parameters:
      K - The map key type.
      V - The map value type
      Parameters:
      keyType - The map key type.
      valueType - The map value type
      Returns:
      A TypeToken that represents a Map whose keys and values are of the given key and value types
    • vectorOf

      public static <T> com.google.common.reflect.TypeToken<List<T>> vectorOf(com.google.common.reflect.TypeToken<T> eltType)
      Create a TypeToken that represents a TypeToken whose elements are of the given type.
      Type Parameters:
      T - The vector element type.
      Parameters:
      eltType - The vector element type.
      Returns:
      A TypeToken that represents a TypeToken whose elements are of the given type.