Class RequestBeanSetters

java.lang.Object
org.apache.juneau.rest.server.arg.RequestBeanSetters

public final class RequestBeanSetters extends Object
Resolves and caches the public no-arg constructor and per-getter setter Methods for a concrete (non-interface) @Request bean class.

RequestBeanArg resolves one of these once, when the @RestOp is registered (servlet init), instead of the historical per-request Class.getMethod lookup in RestRequest.newRequestBean. A getter with no matching setter, or a bean with no public no-arg constructor, now fails registration with an IllegalArgumentException naming the bean, the getter and the expected setter — not only the requests that happen to supply that parameter.

Example:

// A concrete request bean: public no-arg constructor plus a setter for every annotated getter. @Request public class MyQuery { private String foo; @Query public String getFoo() { return foo; } public void setFoo(String value) { foo = value; } } RequestBeanMeta meta = RequestBeanMeta.create(MyQuery.class, annotations); RequestBeanSetters setters = RequestBeanSetters.resolve(MyQuery.class, meta); MyQuery bean = setters.newInstance(); setters.set(bean, meta.getProperty("getFoo").getGetter(), "value");

Since:
10.0.0