Class TypeTranslators
java.lang.Object
de.iip_ecosphere.platform.transport.serialization.TypeTranslators
Defines a set of type translators for primitive types.
- Author:
- Holger Eichelberger, SSE
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final TypeTranslator<String, byte[]> String to byte[] translator via base64 encoding.static final TypeTranslator<String, Boolean> Turns a Boolean into a String and back.static final TypeTranslator<byte[], String> byte[] to String translator via base64 encoding.static final TypeTranslator<String, Double> Turns a Double into a String and back.static final TypeTranslator<String, Integer> Turns an Integer into a String and back.static final TypeTranslator<String, String> Turns a string into a quoted string and back.static final TypeTranslator<String, Long> Turns a Long into a String and back.static final TypeTranslator<String, String> Identity transformation for strings. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Serializer<?> createSerializer(ClassLoader loader, String className) Convenience method for creating (custom) serializer instances.static TypeTranslator<?, ?> createTypeTranslator(ClassLoader loader, String className) Convenience method for creating (custom) type translator instances.
-
Field Details
-
STRING
Identity transformation for strings. -
JSON_STRING
Turns a string into a quoted string and back. -
INTEGER
Turns an Integer into a String and back. -
LONG
Turns a Long into a String and back. -
BOOLEAN
Turns a Boolean into a String and back. -
DOUBLE
Turns a Double into a String and back. -
BYTEARRAY_TO_BASE64
byte[] to String translator via base64 encoding. -
BASE64_TO_BYTEARRAY
String to byte[] translator via base64 encoding.
-
-
Constructor Details
-
TypeTranslators
public TypeTranslators()
-
-
Method Details
-
createTypeTranslator
Convenience method for creating (custom) type translator instances.- Parameters:
loader- the class loader to load the class withclassName- the name of the type translator class (must provide a no-argument constructor)- Returns:
- the type translator instance (or null if the translator cannot be found/initialized)
-
createSerializer
Convenience method for creating (custom) serializer instances.- Parameters:
loader- the class loader to load the class withclassName- the name of the type serializer class (must provide a no-argument constructor)- Returns:
- the type serializer instance (or null if the serializer cannot be found/initialized)
-