We have an annotation @Accepts:
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Accepts {
Class[] value();
}
It takes a list of Classes. These are later used to validate in a DSL that a field was passed an instance of the classes listed as acceptable.
Some examples of this annotation in use:
public enum PropertyName {
@Accepts({Integer.class})
xCoordinate,
@Accepts({Integer.class})
yCoordinate,
@Accepts({Boolean.class})
showPermission
@Accepts({String.class, FieldScript.class, List.class})
onClick
/* And So On*/
}
I am adding a new item to this enum called 'value' and it can accept a String or a PropertyResolver. PropertyResolver is an interface defined as below:
public interface PropertyResolver<T> {
public T getValue(TagContext tagContext);
}
I don't know how to do a .class on PropertyResolver to pass on to @Accepts. Is it possible to do so?
Thanks.