if ((methods != null) && (methods.size() > 0))
{
for (Method m : methods)
{
Descriptor d = m.getAnnotation(Descriptor.class);
if (d == null)
{
System.out.println("\n" + m.getName());
}
else
{
System.out.println("\n" + m.getName() + " - " + d.value());
}
System.out.println(" scope: " + name.substring(0, name.indexOf(':')));
// Get flags and options.
Class[] paramTypes = m.getParameterTypes();
Map<String, Parameter> flags = new TreeMap();
Map<String, String> flagDescs = new TreeMap();
Map<String, Parameter> options = new TreeMap();
Map<String, String> optionDescs = new TreeMap();
List<String> params = new ArrayList();
Annotation[][] anns = m.getParameterAnnotations();
for (int paramIdx = 0; paramIdx < anns.length; paramIdx++)
{
Parameter p = findAnnotation(anns[paramIdx], Parameter.class);
d = findAnnotation(anns[paramIdx], Descriptor.class);
if (p != null)
{
if (p.presentValue().equals(Parameter.UNSPECIFIED))
{
options.put(p.names()[0], p);
if (d != null)
{
optionDescs.put(p.names()[0], d.value());
}
}
else
{
flags.put(p.names()[0], p);
if (d != null)
{
flagDescs.put(p.names()[0], d.value());
}
}
}
else if (d != null)
{
params.add(paramTypes[paramIdx].getSimpleName());
params.add(d.value());
}
else
{
params.add(paramTypes[paramIdx].getSimpleName());
params.add("");