io.micronaut.coherence.data.interceptors.GetMapInterceptor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of micronaut-coherence-data Show documentation
Show all versions of micronaut-coherence-data Show documentation
Integration between Micronaut and Oracle Coherence
/*
* Copyright 2017-2021 original authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.micronaut.coherence.data.interceptors;
import com.tangosol.net.NamedMap;
import io.micronaut.aop.MethodInvocationContext;
import io.micronaut.coherence.data.ops.CoherenceRepositoryOperations;
import io.micronaut.core.annotation.NonNull;
import io.micronaut.data.intercept.DataInterceptor;
import io.micronaut.data.intercept.RepositoryMethodKey;
import io.micronaut.data.operations.RepositoryOperations;
import io.micronaut.data.runtime.intercept.AbstractQueryInterceptor;
/**
* A {@link DataInterceptor} allowing {@link io.micronaut.coherence.data.AbstractCoherenceRepository} instances
* to obtain the {@link NamedMap} associated with the {@link io.micronaut.coherence.data.AbstractCoherenceRepository}.
*
* @param the declaring type
* @param the entity type
* @param the ID type of the entity
*/
public final class GetMapInterceptor
extends AbstractQueryInterceptor>
implements DataInterceptor> {
// ----- constructors -----------------------------------------------
/**
* Default constructor.
*
* @param operations the {@link RepositoryOperations}
*/
protected GetMapInterceptor(@NonNull RepositoryOperations operations) {
super(operations);
}
// ----- DataInterceptor --------------------------------------------
@Override
public NamedMap intercept(final RepositoryMethodKey methodKey,
final MethodInvocationContext> context) {
return ((CoherenceRepositoryOperations) operations).getNamedMap();
}
}