public final class Utils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
additionalFilterGenerator(Map<String,Serializable> additionalFilters)
Generates the part of the query where clause that will hit the Cassandra's secondary indexes.
|
static String |
batchQueryGenerator(List<String> statements)
Returns a CQL batch query wrapping the given statements.
|
static scala.Tuple2<Cells,Cells> |
cellList2tuple(Cells cells)
Utility method that converts an IDeepType to tuple of two Cells.
The first Cells element contains the list of Cell elements that represent the key (partition + cluster key). |
static String |
createTableQueryGenerator(Cells keys,
Cells values,
String outputKeyspace,
String outputColumnFamily)
Generates a create table cql statement from the given Cells description.
|
static <T extends IDeepType> |
deepType2tuple(T e)
Convers an instance of type
|
static Method |
findGetter(String propertyName,
Class entityClass)
Resolves the getter name for the property whose name is 'propertyName' whose type is 'valueType'
in the entity bean whose class is 'entityClass'.
|
static Method |
findSetter(String propertyName,
Class entityClass,
Class valueType)
Resolves the setter name for the property whose name is 'propertyName' whose type is 'valueType'
in the entity bean whose class is 'entityClass'.
|
static Field[] |
getAllFields(Class clazz)
Return the set of fields declared at all level of class hierachy
|
static InetAddress |
inetAddressFromLocation(String location)
Returns the inet address for the specified location.
|
static <T> org.apache.cassandra.db.marshal.AbstractType<?> |
marshallerInstance(T obj)
Returns an instance of the Cassandra validator that matches the provided object.
|
static <T extends IDeepType> |
newTypeInstance(Class<T> clazz)
Creates a new instance of the given class.
|
static <T> T |
newTypeInstance(String className,
Class<T> returnClass)
Creates a new instance of the given class name.
|
static scala.Tuple2<String[],Object[]> |
prepareTuple4CqlDriver(scala.Tuple2<Cells,Cells> tuple)
Splits columns names and values as required by Datastax java driver to generate an Insert query.
|
static String |
quote(String identifier)
Quoting for working with uppercase
|
static String |
singleQuote(String identifier)
Quoting for working with uppercase
|
static String |
updateQueryGenerator(Cells keys,
Cells values,
String outputKeyspace,
String outputColumnFamily)
Generates the update query for the provided IDeepType.
|
public static scala.Tuple2<Cells,Cells> cellList2tuple(Cells cells)
cells - the Cells object to process.public static <T extends IDeepType> scala.Tuple2<Cells,Cells> deepType2tuple(T e)
T - the entity object generic type.e - the entity object to process.public static <T extends IDeepType> T newTypeInstance(Class<T> clazz)
clazz - the class object for which a new instance should be created.public static <T> T newTypeInstance(String className, Class<T> returnClass)
className - the class object for which a new instance should be created.public static String additionalFilterGenerator(Map<String,Serializable> additionalFilters)
additionalFilters - the map of filters names and values.public static String createTableQueryGenerator(Cells keys, Cells values, String outputKeyspace, String outputColumnFamily)
keys - the row keys wrapped inside a Cells object.values - all the other row columns wrapped inside a Cells object.outputKeyspace - the output keyspace.outputColumnFamily - the output column family.public static String updateQueryGenerator(Cells keys, Cells values, String outputKeyspace, String outputColumnFamily)
keys - the row keys wrapped inside a Cells object.values - all the other row columns wrapped inside a Cells object.outputKeyspace - the output keyspace.outputColumnFamily - the output column family.public static String batchQueryGenerator(List<String> statements)
statements - the list of statements to use to generate the batch statement.public static scala.Tuple2<String[],Object[]> prepareTuple4CqlDriver(scala.Tuple2<Cells,Cells> tuple)
tuple - an object containing the key Cell(s) as the first element and all the other columns as the second element.public static Method findSetter(String propertyName, Class entityClass, Class valueType)
propertyName - the field name of the property whose setter we want to resolve.entityClass - the bean class object in which we want to search for the setter.valueType - the class type of the object that we want to pass to the setter.public static Method findGetter(String propertyName, Class entityClass)
propertyName - the field name of the property whose getter we want to resolve.entityClass - the bean class object in which we want to search for the getter.public static <T> org.apache.cassandra.db.marshal.AbstractType<?> marshallerInstance(T obj)
T - the generic object type.obj - the object to use to resolve the cassandra marshaller.DeepGenericException - if no validator can be found for the specified object.public static InetAddress inetAddressFromLocation(String location)
location - the address as StringCopyright © 2014. All rights reserved.