Annotation Type SchemaSwap
-
@Target({ANNOTATION_TYPE,TYPE_USE,TYPE}) @Retention(RUNTIME) @Repeatable(SchemaSwaps.class) public @interface SchemaSwap
Annotation that allows replacing a nested schema with one from another class. This is an alternative toSchemaFromfor cases when the classes are coming from an external source and fields cannot be annotated directly.- See Also:
SchemaFrom
-
-
Required Element Summary
Required Elements Modifier and Type Required Element Description StringfieldNameName of the field whose type is to be replaced.Class<?>originalTypeThe owning class of the field whose type is to be replaced.
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description intdepthFor fields that may include a reference cycle, how many expansions to include in the output before including thetargetType()Class<?>targetTypeThe replacement schema that will be used for thefieldName()instead of its specified type
-
-
-
Element Detail
-
originalType
Class<?> originalType
The owning class of the field whose type is to be replaced.It is an error if the type is not used in the same schema hierarchy where the
SchemaSwapis used.
-
-
-
fieldName
String fieldName
Name of the field whose type is to be replaced.The name should be specified exactly as defined in the Java class, before any renames and transformations (
@JsonPropertyand similar) take place.It is an error if the field does not exist on
originalType()
-
-
-
targetType
Class<?> targetType
The replacement schema that will be used for thefieldName()instead of its specified typeThe default value of
void.classcauses the field to be skipped- Default:
- void.class
-
-
-
depth
int depth
For fields that may include a reference cycle, how many expansions to include in the output before including thetargetType()The default value of 0 replaces the field with the
targetType()without any expansion- Default:
- 0
-
-