this.method = method;
this.methodInjector = injector.createMethodInjector(clazz, method);
Produces p = method.getAnnotation(Produces.class);
if (p == null) p = clazz.getAnnotation(Produces.class);
Consumes c = method.getAnnotation(Consumes.class);
if (c == null) c = clazz.getAnnotation(Consumes.class);
if (p != null)
{
produces = new MediaType[p.value().length];
int i = 0;
for (String mediaType : p.value())
{
produces[i++] = MediaType.valueOf(mediaType);
preferredProduces.add(WeightedMediaType.valueOf(mediaType));
}
}
if (c != null)
{
consumes = new MediaType[c.value().length];
int i = 0;
for (String mediaType : c.value())
{
consumes[i++] = MediaType.valueOf(mediaType);
preferredConsumes.add(WeightedMediaType.valueOf(mediaType));
}
}