org.hibernate.validation.util.GetAnnotationParameter Maven / Gradle / Ivy
package org.hibernate.validation.util;
import java.lang.annotation.Annotation;
import java.security.PrivilegedAction;
import org.hibernate.validation.util.ReflectionHelper;
/**
* @author Emmanuel Bernard
*/
public class GetAnnotationParameter implements PrivilegedAction {
private final Annotation annotation;
private final String parameterName;
private final Class type;
public static GetAnnotationParameter action(Annotation annotation, String parameterName, Class type) {
return new GetAnnotationParameter( annotation, parameterName, type );
}
private GetAnnotationParameter(Annotation annotation, String parameterName, Class type) {
this.annotation = annotation;
this.parameterName = parameterName;
this.type = type;
}
public T run() {
return ReflectionHelper.getAnnotationParameter( annotation, parameterName, type );
}
}