Package io.ran
Annotation Interface Serialized
Serialized
is used to specify the serializer for a field, in cases where non-standard serialization is
required.
This can be used to serialize a field to a JSON string, or to serialize fields in a backwards-compatible way, among other things.
Example:
public class User {
@Serialized(serializer = UserSerializer.class)
public User user;
public String name;
public String email;
}
This will use the UserSerializer
class to serialize the user
field, instead of the default serializer.
The UserSerializer
class must implement the ISerializer
interface.
NOTE: If you need custom serialization for a collection of objects such as List<User>
, you should use a
custom subclass of the collection, such as UserList extends ArrayList<User>
- See Also:
-
Required Element Summary
Required ElementsModifier and TypeRequired ElementDescriptionClass<? extends ISerializer>
The serializer class to use for this field.
-
Element Details
-
serializer
Class<? extends ISerializer> serializerThe serializer class to use for this field.- Returns:
- the serializer class, which must implement the
ISerializer
interface
-