D - Type of the actual Mongo Database.C - Type of the actual Mongo Collection.public class SessionAwareMethodInterceptor<D,C> extends Object implements MethodInterceptor
MethodInterceptor implementation looking up and invoking an alternative target method having
ClientSession as its first argument. This allows seamless integration with the existing code base.
MethodInterceptor is aware of methods on MongoCollection that my return new instances of itself
like (eg. MongoCollection.withWriteConcern(WriteConcern) and decorate them
if not already proxied.| Modifier and Type | Class and Description |
|---|---|
static interface |
SessionAwareMethodInterceptor.ClientSessionOperator<T>
Represents an operation upon two operands of the same type, producing a result of the same type as the operands
accepting
ClientSession. |
| Constructor and Description |
|---|
SessionAwareMethodInterceptor(com.mongodb.session.ClientSession session,
T target,
Class<? extends com.mongodb.session.ClientSession> sessionType,
Class<D> databaseType,
SessionAwareMethodInterceptor.ClientSessionOperator<D> databaseDecorator,
Class<C> collectionType,
SessionAwareMethodInterceptor.ClientSessionOperator<C> collectionDecorator)
Create a new SessionAwareMethodInterceptor for given target.
|
| Modifier and Type | Method and Description |
|---|---|
protected Object |
decorate(Object target) |
Object |
invoke(MethodInvocation methodInvocation) |
public SessionAwareMethodInterceptor(com.mongodb.session.ClientSession session,
T target,
Class<? extends com.mongodb.session.ClientSession> sessionType,
Class<D> databaseType,
SessionAwareMethodInterceptor.ClientSessionOperator<D> databaseDecorator,
Class<C> collectionType,
SessionAwareMethodInterceptor.ClientSessionOperator<C> collectionDecorator)
T - target object type.session - the ClientSession to be used on invocation.target - the original target object.databaseType - the MongoDB database typedatabaseDecorator - a SessionAwareMethodInterceptor.ClientSessionOperator used to create the proxy for an imperative / reactive
MongoDatabase.collectionType - the MongoDB collection type.collectionDecorator - a SessionAwareMethodInterceptor.ClientSessionOperator used to create the proxy for an imperative / reactive
MongoCollection.@Nullable public Object invoke(MethodInvocation methodInvocation) throws Throwable
invoke in interface MethodInterceptorThrowableCopyright © 2011–2023 Pivotal Software, Inc.. All rights reserved.