Annotation Interface ProtoAdapter
A marshalling adapter for a target class or enum that cannot be annotated for various reasons. This class will handle
the schema definition and marshalling for the target by declaring a protobuf schema via annotations.
This class will not become marshallable! It is the target class that becomes marshallable.
This class will not become marshallable! It is the target class that becomes marshallable.
When used on classes:
The class bearing this annotation will have an annotated factory method for the marshalled class and annotated
accessor methods for each field. These methods can be instance or static methods and their first argument must be
the marshalled class. Annotations must be placed only on methods. Direct field annotations are not allowed.
This class must be thread-safe and stateless and must have an accessible no argument constructor. A single instance
of it will be created per SerializationContext
.
When used on enums:
For each enum value in this enum there must exist en identically named enum value in the target enum.
- Since:
- 4.4
- Author:
- [email protected]
-
Element Details
-
value
Class<?> valueThe actual class being marshalled.
-
-
-
subClassNames
String[] subClassNamesAny sub-classes of the main class specified byvalue()
which should also be handled by this adapter. This is useful, for example, when implementing an adapter for an interface, but the actual implementation class is determined by a factory method, such asList.of()
. This element uses names instead of actual classes so that it is possible to specify non-public classes.- Default:
- {}
-