@Repeatable(value=RequestConverters.class) @Retention(value=RUNTIME) @Target(value={TYPE,METHOD,PARAMETER,CONSTRUCTOR,FIELD}) public @interface RequestConverter
RequestConverterFunction class which converts an AggregatedHttpRequest to
an object.
It can be specified on a class, a method and a parameter in an annotated service. Its scope is determined by where it is specified, e.g.
> @RequestConverter(AliceConverter.class)
> @RequestConverter(BobConverter.class)
> public class MyService {
>
> @Get("/general")
> @RequestConverter(CarolConverter.class)
> public HttpResponse general(Alice a, Bob b, Carol c) {
> // Try CarolConverter, AliceConverter and BobConverter in order, for converting each parameter.
> }
>
> @Get("/special")
> public HttpResponse special(@RequestConverter(SuperAliceConverter.class) Alice a, Bob b) {
> // Try SuperAliceConverter, AliceConverter and BobConverter in order, for converting parameter 'a'.
> // Try AliceConverter and BobConverter in order, for converting parameter 'b'.
> }
> }
RequestConverterFunction,
RequestObject| Modifier and Type | Required Element and Description |
|---|---|
Class<? extends RequestConverterFunction> |
value
RequestConverterFunction implementation type. |
public abstract Class<? extends RequestConverterFunction> value
RequestConverterFunction implementation type. The specified class must have an accessible
default constructor.Copyright © 2020 LeanCloud. All rights reserved.