[[_resources_metadata]]
== Resources metadata configuration

When processing {spec-name} deployments, RESTEasy relies on `ResourceBuilder` to create metadata for each  resource.
Such metadata is defined using the metadata SPI in package `org.jboss.resteasy.spi.metadata`, in particular the `ResourceClass` interface:
[source,java]
----
package org.jboss.resteasy.spi.metadata;

public interface ResourceClass {
  String getPath();

  Class<?> getClazz();

  ResourceConstructor getConstructor();

  FieldParameter[] getFields();

  SetterParameter[] getSetters();

  ResourceMethod[] getResourceMethods();

  ResourceLocator[] getResourceLocators();
}
----
Among the other classes and interfaces defining metadata SPI, the following interfaces are worth a mention here: 
[source,java]
----
public interface ResourceConstructor {
  ResourceClass getResourceClass();

  Constructor getConstructor();

  ConstructorParameter[] getParams();
}

public interface ResourceMethod extends ResourceLocator {
  SetString getHttpMethods();

  MediaType[] getProduces();

  MediaType[] getConsumes();

  boolean isAsynchronous();

  void markAsynchronous();
}

public interface ResourceLocator {
  ResourceClass getResourceClass();

  Class<?> getReturnType();

  Type getGenericReturnType();

  Method getMethod();

  Method getAnnotatedMethod();

  MethodParameter[] getParams();

  String getFullpath();

  String getPath();

}
----

The interesting point is that RESTEasy allows tuning the metadata generation by providing implementations of the `ResourceClassProcessor` interface:

[source,java]
----
package org.jboss.resteasy.spi.metadata;

public interface ResourceClassProcessor {

  /**
   * Allows the implementation of this method to modify the resource metadata represented by
   * the supplied {@link ResourceClass} instance. Implementation will typically create
   * wrappers which modify only certain aspects of the metadata.
   *
   * @param clazz The original metadata
   * @return the (potentially modified) metadata (never null)
   */
  ResourceClass process(ResourceClass clazz);

}
----

The processors are meant to be, and are resolved as, regular {spec-name} annotated providers.
They allow for wrapping resource metadata classes with custom versions that can be used for various advanced scenarios like 

* adding additional resource method/locators to the resource 
* altering the http methods 
* altering the @Produces / @Consumes media types 

