for (ResourceInvoker invoker : invokers)
{
if (invoker instanceof ResourceMethod)
{
ResourceMethod rm = (ResourceMethod) invoker;
for (String httpMethod : rm.getHttpMethods())
{
ResourceMethodEntry method = null;
if (httpMethod.equals("GET")) method = new GetResourceMethod();
else if (httpMethod.equals("PUT")) method = new PutResourceMethod();
else if (httpMethod.equals("DELETE")) method = new DeleteResourceMethod();
else if (httpMethod.equals("POST")) method = new PostResourceMethod();
else if (httpMethod.equals("OPTIONS")) method = new OptionsResourceMethod();
else if (httpMethod.equals("TRACE")) method = new TraceResourceMethod();
else if (httpMethod.equals("HEAD")) method = new HeadResourceMethod();
method.setClazz(rm.getResourceClass().getName());
method.setMethod(rm.getMethod().getName());
AtomicLong stat = rm.getStats().get(httpMethod);
if (stat != null) method.setInvocations(stat.longValue());
else method.setInvocations(0);
if (rm.getProduces() != null)
{
for (MediaType mediaType : rm.getProduces())
{
method.getProduces().add(mediaType.toString());
}
}
if (rm.getConsumes() != null)
{
for (MediaType mediaType : rm.getConsumes())
{
method.getConsumes().add(mediaType.toString());
}
}
entry.getMethods().add(method);