I want to show compilation error or force to above method to use annotation @cacheKey for parameter(userId)

14 Views Asked by At

I have below annotation for method:

@Retention(RetentionPolicy.RUNTIME)
@Target(Element.Method))
public @interface Memcacheable {
    int expiresAfterSeconds() default -1;
    String cacheKey();
    String cacheType() default "MemCache";
}

and I have below annotation for parameter:

@Retention(RetentionPolicy.RUNTIME)
@Target(Element.Parameter))
public @interface CacheKey {
}

And I have below method with annotates @Memcacheable:

@Memcacheable(cacheKey = "abc")
    public static String getDefaultShopShareSettings( Integer userId) {
}

I want to show compilation error or force to above method to use annotation @cacheKey for parameter(userId)

0

There are 0 best solutions below