public class

MappingUtil

extends Object
java.lang.Object
   ↳ com.netflix.astyanax.mapping.MappingUtil

Class Overview

Higher level mapping functions. Methods that behave similar to a Map.

Summary

Public Constructors
MappingUtil(Keyspace keyspace)
MappingUtil(Keyspace keyspace, AnnotationSet<?, ?> annotationSet)
MappingUtil(Keyspace keyspace, MappingCache cache)
MappingUtil(Keyspace keyspace, MappingCache cache, AnnotationSet<?, ?> annotationSet)
Public Methods
<T, K> T get(ColumnFamily<K, String> columnFamily, K id, Class<T> itemClass)
Get the specified item by its key/id
<T, K> List<T> getAll(ColumnFamily<K, String> columnFamily, Class<T> itemClass)
Get all rows of the specified item
<T> Mapping<T> getMapping(Class<T> clazz)
Return the mapping instance for the given class
<T, K> void put(ColumnFamily<K, String> columnFamily, T item)
Add/update the given item
<T, K> void remove(ColumnFamily<K, String> columnFamily, T item)
Remove the given item
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public MappingUtil (Keyspace keyspace)

Parameters
keyspace keyspace to use

public MappingUtil (Keyspace keyspace, AnnotationSet<?, ?> annotationSet)

Parameters
keyspace keyspace to use
annotationSet annotation set to use

public MappingUtil (Keyspace keyspace, MappingCache cache)

Parameters
keyspace keyspace to use
cache cache to use

public MappingUtil (Keyspace keyspace, MappingCache cache, AnnotationSet<?, ?> annotationSet)

Parameters
keyspace keyspace to use
cache cache to use
annotationSet annotation set to use

Public Methods

public T get (ColumnFamily<K, String> columnFamily, K id, Class<T> itemClass)

Get the specified item by its key/id

Parameters
columnFamily column family of the item
id id/key of the item
itemClass item's class
Returns
  • new instance with the item's columns propagated
Throws
Exception errors

public List<T> getAll (ColumnFamily<K, String> columnFamily, Class<T> itemClass)

Get all rows of the specified item

Parameters
columnFamily column family of the item
itemClass item's class
Returns
  • new instances with the item's columns propagated
Throws
Exception errors

public Mapping<T> getMapping (Class<T> clazz)

Return the mapping instance for the given class

Parameters
clazz the class
Returns
  • mapping instance (new or from cache)

public void put (ColumnFamily<K, String> columnFamily, T item)

Add/update the given item

Parameters
columnFamily column family of the item
item the item to add/update
Throws
Exception errors

public void remove (ColumnFamily<K, String> columnFamily, T item)

Remove the given item

Parameters
columnFamily column family of the item
item the item to remove
Throws
Exception errors