我正在尝试为 Cassandra DB 使用 Datastax Java 驱动程序API,并且我有一个具有 getList 函数的行对象:
public <T> List<T> getList(String name,
Class<T> elementsClass)
Returns the value of column name as a list.
Parameters:
name - the name of the column to retrieve.
elementsClass - the class for the elements of the list to retrieve.
Returns:
the value of the ith column in this row as a list of elementsClass objects. If the value is NULL, an empty list is returned (note that Cassandra makes no difference between an empty list and column of type list that is not set).
我的问题是我如何实际使用它?我不知道如何制作Class<T> elementsClass
类型参数。在我的例子中,结果应该是一个浮点列表(基于我正在使用的 Cassandra 模式)。