Annotation Type Content
Identifies a POJO to be used as the body of an HTTP request.
Can be used in the following locations:
- Arguments and argument-types of server-side
@RestOp -annotated methods. - Arguments and argument-types of client-side
@RemoteOp -annotated interfaces. - Methods and return types of server-side and client-side
@Request -annotated interfaces.
Arguments and argument-types of server-side @RestOp-annotated methods
On server-side REST, this annotation can be applied to method parameters or parameter classes to identify them as the body of an HTTP request.
Examples:
This is functionally equivalent to the following code...
Arguments and argument-types of client-side @RemoteResource-annotated interfaces
See Also:
Methods and return types of server-side and client-side @Request-annotated interfaces
See Also:
Notes:
-
Annotation parameter values will be aggregated when used on POJO parent and child classes.
Values on child classes override values on parent classes. -
Annotation parameter values will be aggregated when used on both POJOs and REST methods.
Values on methods override values on POJO classes. -
If using this annotation on a Spring bean, note that you are likely to encounter issues when using on parameterized
types such as
List<MyBean>
. This is due to the fact that Spring uses CGLIB to recompile classes at runtime, and CGLIB was written before generics were introduced into Java and is a virtually-unsupported library. Therefore, parameterized types will often be stripped from class definitions and replaced with unparameterized types (e.g.List
). Under these circumstances, you are likely to getClassCastExceptions
when trying to access generalizedJsonMaps
as beans. The best solution to this issue is to either specify the parameter as a bean array (e.g.MyBean[]
) or declare the method as final so that CGLIB will not try to recompile it.
See Also:
-
Optional Element Summary
-
Element Details
-
on
Dynamically apply this annotation to the specified classes.See Also:
- Returns:
- The annotation value.
- Default:
- {}
-
onClass
Dynamically apply this annotation to the specified classes.Identical to
on()
except allows you to specify class objects instead of a strings.See Also:
- Returns:
- The annotation value.
- Default:
- {}
-
schema
schema field of the Swagger Parameter Object.The schema defining the type used for parameter.
This is a required attribute per the swagger definition. However, if not explicitly specified, the value will be auto-generated using
JsonSchemaSerializer
.The
@Schema
annotation can also be used standalone on the parameter or type. Values specified on this field override values specified on the type, and values specified on child types override values specified on parent types.Used for:
- Server-side schema-based parsing and parsing validation.
- Server-side generated Swagger documentation.
- Client-side schema-based serializing and serializing validation.
- Returns:
- The annotation value.
- Default:
- @org.apache.juneau.annotation.Schema
-