public abstract class MapperBuilder<MapperT> extends Object
Mapper
-annotated interface wrapping a CqlSession
.
The mapper generates an implementation of this class for every such interface. It is either
named <InterfaceName>Builder
, or what you provided in Mapper.builderName()
.
Modifier and Type | Field and Description |
---|---|
protected Map<Object,Object> |
customState |
protected CqlSession |
session |
Modifier | Constructor and Description |
---|---|
protected |
MapperBuilder(CqlSession session) |
Modifier and Type | Method and Description |
---|---|
abstract MapperT |
build() |
MapperBuilder<MapperT> |
withCustomState(Object key,
Object value)
Stores custom state that will be propagated to
MapperContext.getCustomState() . |
protected final CqlSession session
protected MapperBuilder(CqlSession session)
@NonNull public MapperBuilder<MapperT> withCustomState(@Nullable Object key, @Nullable Object value)
MapperContext.getCustomState()
.
This is intended mainly for QueryProvider
methods: since provider classes are
instantiated directly by the generated mapper code, they have no way to access non-static state
from the rest of your application. This method allows you to pass that state while building the
mapper, and access it later at runtime.
Note that this state will be accessed concurrently, it should be thread-safe.
public abstract MapperT build()
Copyright © 2017–2019. All rights reserved.