View Javadoc

1   package org.kuali.student.r1.common.assembly.util.spring;
2   
3   import org.aspectj.lang.ProceedingJoinPoint;
4   import org.kuali.student.r1.common.assembly.data.Metadata;
5   import org.kuali.student.common.util.spring.MethodArgsToObjectEhcacheAdvice;
6   
7   public class MetadataMethodEhcacheAdvice extends MethodArgsToObjectEhcacheAdvice {
8   
9   	@Override
10  	public Object getFromCache(ProceedingJoinPoint pjp) throws Throwable {
11  		try{
12  			//Return a copy so that if the data is mutated the original remains
13  			Metadata result = (Metadata) super.getFromCache(pjp);
14  			return new Metadata(result);
15  		}catch(ClassCastException e){
16  			throw new RuntimeException("This cache should only be used on methods that return Metadata", e);
17  		}
18  	}
19  
20  	
21  }