Package org.springframework.data.mongodb
Class SessionAwareMethodInterceptor<D,C>
java.lang.Object
org.springframework.data.mongodb.SessionAwareMethodInterceptor<D,C>
- Type Parameters:
D- Type of the actual Mongo Database.C- Type of the actual Mongo Collection.
- All Implemented Interfaces:
Advice,Interceptor,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.
The
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.- Since:
- 2.1
- Author:
- Christoph Strobl, Mark Paluch
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceRepresents an operation upon two operands of the same type, producing a result of the same type as the operands acceptingClientSession. -
Constructor Summary
ConstructorsConstructorDescriptionSessionAwareMethodInterceptor(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. -
Method Summary
-
Constructor Details
-
SessionAwareMethodInterceptor
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) Create a new SessionAwareMethodInterceptor for given target.- Type Parameters:
T- target object type.- Parameters:
session- theClientSessionto be used on invocation.target- the original target object.databaseType- the MongoDB database typedatabaseDecorator- aSessionAwareMethodInterceptor.ClientSessionOperatorused to create the proxy for an imperative / reactiveMongoDatabase.collectionType- the MongoDB collection type.collectionDecorator- aSessionAwareMethodInterceptor.ClientSessionOperatorused to create the proxy for an imperative / reactiveMongoCollection.
-
-
Method Details
-
invoke
- Specified by:
invokein interfaceMethodInterceptor- Throws:
Throwable
-
decorate
-