public interface Surrogate
Surrogate classes are used in place of other classes during serialization.
For example, you may want to use a surrogate class to change the names or order of bean properties on a bean.
This interface has no methods to implement.
It's simply used by the framework to identify the class as a surrogate class when specified as a swap.
The following is an example of a surrogate class change changes a property name:
Surrogate classes are associated with serializers and parsers using the BeanContextBuilder.swaps(Object...)
method.
JsonSerializer s = JsonSerializer
.
Surrogates can also be associated using the @Swap
annotation.
On a side note, a surrogate class is functionally equivalent to the following PojoSwap
implementation:
Copyright © 2016–2020 The Apache Software Foundation. All rights reserved.