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;
020import javax.cache.annotation.CacheInvocationParameter;
021import javax.cache.annotation.CacheMethodDetails;
022
023import org.springframework.cache.interceptor.BasicOperation;
024import org.springframework.cache.interceptor.CacheResolver;
025
026/**
027 * Model the base of JSR-107 cache operation through an interface contract.
028 *
029 * <p>A cache operation can be statically cached as it does not contain any
030 * runtime operation of a specific cache invocation.
031 *
032 * @author Stephane Nicoll
033 * @since 4.1
034 * @param <A> the type of the JSR-107 annotation
035 */
036public interface JCacheOperation<A extends Annotation> extends BasicOperation, CacheMethodDetails<A> {
037
038        /**
039         * Return the {@link CacheResolver} instance to use to resolve the cache
040         * to use for this operation.
041         */
042        CacheResolver getCacheResolver();
043
044        /**
045         * Return the {@link CacheInvocationParameter} instances based on the
046         * specified method arguments.
047         * <p>The method arguments must match the signature of the related method invocation
048         * @param values the parameters value for a particular invocation
049         */
050        CacheInvocationParameter[] getAllParameters(Object... values);
051
052}