private static Tuple get(Annotation... ab) {
Argument argumentAnn = null;
Option optionAnn = null;
Boolean required = null;
Description description = new Description(ab);
Annotation info = null;
for (Annotation parameterAnnotation : ab) {
if (parameterAnnotation instanceof Option) {
optionAnn = (Option)parameterAnnotation;
} else if (parameterAnnotation instanceof Argument) {
argumentAnn = (Argument)parameterAnnotation;
} else if (parameterAnnotation instanceof Required) {
required = ((Required)parameterAnnotation).value();
} else if (info == null) {
// Look at annotated annotations
Class<? extends Annotation> a = parameterAnnotation.annotationType();
if (a.getAnnotation(Option.class) != null) {
optionAnn = a.getAnnotation(Option.class);
info = parameterAnnotation;
} else if (a.getAnnotation(Argument.class) != null) {
argumentAnn = a.getAnnotation(Argument.class);
info = parameterAnnotation;
}
//
if (info != null) {
//
description = new Description(description, new Description(a));
//
if (required == null) {
Required metaReq = a.getAnnotation(Required.class);
if (metaReq != null) {