001/*
002 * Copyright 2002-2019 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.cache.jcache.interceptor;
018
019import java.lang.annotation.Annotation;
020
021import javax.cache.annotation.CacheInvocationParameter;
022import javax.cache.annotation.CacheMethodDetails;
023
024import org.springframework.cache.interceptor.BasicOperation;
025import org.springframework.cache.interceptor.CacheResolver;
026
027/**
028 * Model the base of JSR-107 cache operation through an interface contract.
029 *
030 * <p>A cache operation can be statically cached as it does not contain any
031 * runtime operation of a specific cache invocation.
032 *
033 * @author Stephane Nicoll
034 * @since 4.1
035 * @param <A> the type of the JSR-107 annotation
036 */
037public interface JCacheOperation<A extends Annotation> extends BasicOperation, CacheMethodDetails<A> {
038
039        /**
040         * Return the {@link CacheResolver} instance to use to resolve the cache
041         * to use for this operation.
042         */
043        CacheResolver getCacheResolver();
044
045        /**
046         * Return the {@link CacheInvocationParameter} instances based on the
047         * specified method arguments.
048         * <p>The method arguments must match the signature of the related method invocation
049         * @param values the parameters value for a particular invocation
050         */
051        CacheInvocationParameter[] getAllParameters(Object... values);
052
053}