All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.maxifier.mxcache.provider.AnnotationProperty Maven / Gradle / Ivy

Go to download

Constains all classes necessary for launching a MxCache-instrumentated application

There is a newer version: 2.6.9
Show newest version
/*
 * Copyright (c) 2008-2014 Maxifier Ltd. All Rights Reserved.
 */
package com.maxifier.mxcache.provider;

import javax.annotation.Nonnull;
import java.lang.annotation.Annotation;

/**
 * 

AnnotationProperty are like StrategyProperty but they allow to use custom annotation to override the value of * property.

*

In most cases you should not extend this class directly, use * {@link com.maxifier.mxcache.provider.ReflectiveAnnotationProperty} instead.

* * @see ReflectiveAnnotationProperty * * @author Alexander Kochurov ([email protected]) */ public abstract class AnnotationProperty extends StrategyProperty { private final Class annotationType; protected AnnotationProperty(String name, Class type, Class annotationType, T defaultValue) { super(name, type, defaultValue); if (!Annotation.class.isAssignableFrom(annotationType)) { throw new IllegalArgumentException(annotationType + " is not annotation type"); } this.annotationType = annotationType; } protected AnnotationProperty(String name, Class type, Class annotationType) { this(name, type, annotationType, null); } /** * Gets the value from annotation. Implement this method for your custom annotations. * @param annotation your custom annotation. * @return the value of property; null means that MxCache should lookup the value in xml configuration */ public abstract T getFromAnnotation(@Nonnull A annotation); public Class getAnnotationType() { return annotationType; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy