{title:'RestOpContext', created:'9.0.0'}

The {@link oajr.RestOpContext} object is the workhorse class for an individual {@link oajr.annotation.RestOp}-annotated method.

Every class annotated with @RestOp ends up with an instance of this object. Similar to {@link oajr.RestContext}, the object is read-only and unchangeable and is initialized with all of the various annotations pulled from the method. All functionality available through annotations have programmatic equivalents through the builder of this class.

To access the builder for these objects, simply implement the following init method that will be called for each {@link oajr.annotation.RestOp}-annotated method.

| // Use an init hook with RestOpContext.Builder as a parameter. | @RestInit | public void init(RestOpContext.Builder builder) throws Exception { | builder | .beanContext(x -> x.swaps(TemporalCalendarSwap.Rfc1123DateTime.class)) | .debugEnablement(CONDITIONAL); | }

There are multiple ways to programmatically alter how RestOpContext behaves. The most straightforward are the following builder methods which are direct equivalents to values defined on the {@link oaj.rest.annotation.RestOp} annotation:

- {@link oaj.rest.RestOpContext.Builder}
  - {@link oaj.rest.RestOpContext.Builder#clientVersion(String) clientVersion}
  - {@link oaj.rest.RestOpContext.Builder#consumes(MediaType...) consumes}
  - {@link oaj.rest.RestOpContext.Builder#debug(Enablement) debug}
  - {@link oaj.rest.RestOpContext.Builder#defaultCharset(Charset) defaultCharset}
  - {@link oaj.rest.RestOpContext.Builder#dotAll() dotAll}
  - {@link oaj.rest.RestOpContext.Builder#httpMethod(String) httpMethod}
  - {@link oaj.rest.RestOpContext.Builder#maxInput(String) maxInput}
  - {@link oaj.rest.RestOpContext.Builder#path(String...) path}
  - {@link oaj.rest.RestOpContext.Builder#produces(MediaType...) produces}
  - {@link oaj.rest.RestOpContext.Builder#roleGuard(String) roleGuard}
  - {@link oaj.rest.RestOpContext.Builder#rolesDeclared(String...) rolesDeclared}

For more complex configurations, access to sub-builders is provided via the following methods:

- {@link oaj.rest.RestOpContext.Builder}
  - {@link oaj.rest.RestOpContext.Builder#converters() converters}
  - {@link oaj.rest.RestOpContext.Builder#defaultClasses() defaultClasses}
  - {@link oaj.rest.RestOpContext.Builder#defaultRequestAttributes() defaultRequestAttributes}
  - {@link oaj.rest.RestOpContext.Builder#defaultRequestFormData() defaultRequestFormData}
  - {@link oaj.rest.RestOpContext.Builder#defaultRequestHeaders() defaultRequestHeaders}
  - {@link oaj.rest.RestOpContext.Builder#defaultRequestQueryData() defaultRequestQueryData}
  - {@link oaj.rest.RestOpContext.Builder#defaultResponseHeaders() defaultResponseHeaders}
  - {@link oaj.rest.RestOpContext.Builder#encoders() encoders}
  - {@link oaj.rest.RestOpContext.Builder#guards() guards}
  - {@link oaj.rest.RestOpContext.Builder#jsonSchemaGenerator() jsonSchemaGenerator}
  - {@link oaj.rest.RestOpContext.Builder#matchers() matchers}
  - {@link oaj.rest.RestOpContext.Builder#parsers() parsers}
  - {@link oaj.rest.RestOpContext.Builder#partParser() partParser}
  - {@link oaj.rest.RestOpContext.Builder#partSerializer() partSerializer}
  - {@link oaj.rest.RestOpContext.Builder#serializers() serializers}

- It is also possible to override methods on the {@link oajr.RestOpContext} class itself by providing your own specialized subclass via the {@link oaj.rest.RestOpContext.Builder#type(Class)} method.