001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.commons.jcs3.jcache.cdi; 020 021import javax.cache.annotation.CacheMethodDetails; 022import javax.interceptor.InvocationContext; 023import java.lang.annotation.Annotation; 024import java.lang.reflect.Method; 025import java.util.Set; 026 027public class CacheMethodDetailsImpl<A extends Annotation> implements CacheMethodDetails<A> 028{ 029 protected final InvocationContext delegate; 030 private final Set<Annotation> annotations; 031 private final A cacheAnnotation; 032 private final String cacheName; 033 protected final CDIJCacheHelper.MethodMeta meta; 034 035 public CacheMethodDetailsImpl(final InvocationContext delegate, final A cacheAnnotation, final String cacheName, 036 final CDIJCacheHelper.MethodMeta meta) 037 { 038 this.delegate = delegate; 039 this.annotations = meta.getAnnotations(); 040 this.cacheAnnotation = cacheAnnotation; 041 this.cacheName = cacheName; 042 this.meta = meta; 043 } 044 045 @Override 046 public Method getMethod() 047 { 048 return delegate.getMethod(); 049 } 050 051 @Override 052 public Set<Annotation> getAnnotations() 053 { 054 return annotations; 055 } 056 057 @Override 058 public A getCacheAnnotation() 059 { 060 return cacheAnnotation; 061 } 062 063 @Override 064 public String getCacheName() 065 { 066 return cacheName; 067 } 068}