public class MappingManager extends Object
Constructor and Description |
---|
MappingManager(Session session)
Creates a new
MappingManager using the provided Session . |
Modifier and Type | Method and Description |
---|---|
<T> T |
createAccessor(Class<T> klass)
Creates an accessor object based on the provided interface (that must be annotated by
a
Accessor annotation). |
Session |
getSession()
The underlying
Session used by this manager. |
<T> Mapper<T> |
mapper(Class<T> klass)
Creates a
Mapper for the provided class (that must be annotated by a
Table annotation). |
<T> UDTMapper<T> |
udtMapper(Class<T> klass)
Creates a
UDTMapper for the provided class (that must be
annotated by a UDT annotation). |
public MappingManager(Session session)
MappingManager
using the provided Session
.session
- the Session
to use.public Session getSession()
Session
used by this manager.
Note that you can get obtain the Cluster
object corresponding
to that session using getSession().getCluster()
.
It is inadvisable to close the returned Session while this manager and its mappers are in use.
public <T> Mapper<T> mapper(Class<T> klass)
Mapper
for the provided class (that must be annotated by a
Table
annotation).
The MappingManager
only ever keeps one Mapper for each class, and so calling this
method multiple times on the same class will always return the same object.
T
- the type of the class to map.klass
- the (annotated) class for which to return the mapper.Mapper
object for class klass
.public <T> UDTMapper<T> udtMapper(Class<T> klass)
UDTMapper
for the provided class (that must be
annotated by a UDT
annotation).
The MappingManager
only ever keeps one UDTMapper
for each
class, and so calling this method multiple times on the same class will
always return the same object.
T
- the type of the class to map.klass
- the (annotated) class for which to return the mapper.UDTMapper
object for class klass
.public <T> T createAccessor(Class<T> klass)
Accessor
annotation).
The MappingManager
only ever keep one Accessor for each class, and so calling this
method multiple time on the same class will always return the same object.
T
- the type of the accessor class.klass
- the (annotated) class for which to create an accessor object.klass
.Copyright © 2012–2015. All rights reserved.