private static AnnotationTrait getTraits(Class<? extends Annotation> clazz, boolean isTopLevel)
{
final AnnotationTrait trait = new AnnotationTrait();
final RestSpecAnnotation classAnnotation = clazz.getAnnotation(RestSpecAnnotation.class);
if (classAnnotation == null)
{
trait.masterTrait = new MetaTrait(false,
clazz.getCanonicalName(),
isTopLevel,
RestSpecAnnotation.DEFAULT_SKIP_DEFAULT);
}
else
{
trait.masterTrait = new MetaTrait(classAnnotation, clazz.getCanonicalName());
}
trait.memberTraits = new HashMap<Method, MetaTrait>();
for (Method m: clazz.getDeclaredMethods())
{
final RestSpecAnnotation methodAnnotation = m.getAnnotation(RestSpecAnnotation.class);
if (methodAnnotation == null && !trait.masterTrait.exclude)
{
trait.memberTraits.put(m, new MetaTrait(trait.masterTrait.isRestSpecAnnotated,
m.getName(),
trait.masterTrait.exclude,
trait.masterTrait.skipDefault));
}
else if (methodAnnotation != null && !methodAnnotation.exclude())
{
trait.memberTraits.put(m, new MetaTrait(methodAnnotation, m.getName()));
}
}