use of com.webcohesion.enunciate.javac.decorations.element.DecoratedAnnotationMirror in project enunciate by stoicflame.
the class AnnotationValueMethod method exec.
/**
* Returns the qname of the element that has the first parameter as the namespace, the second as the element.
*
* @param list The arguments.
* @return The qname.
*/
public Object exec(List list) throws TemplateModelException {
if (list.size() < 1) {
throw new TemplateModelException("The annotationValue method must have a declaration as a parameter.");
}
TemplateModel from = (TemplateModel) list.get(0);
Object unwrapped = DeepUnwrap.unwrap(from);
String method = "value";
if (list.size() > 1) {
method = (String) DeepUnwrap.unwrap((TemplateModel) list.get(1));
}
if (unwrapped instanceof DecoratedAnnotationMirror) {
return invoke(method, ((DecoratedAnnotationMirror) unwrapped));
}
throw new EnunciateException(String.format("Unsupported method %s on %s", method, unwrapped));
}
Aggregations