Skip to content

Latest commit

 

History

History

databind-typesafe

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

TypeSafe Config Databind for Scribe

This library provides TypeSafe-based serialization for Scribe.

Example Usage

You can setup the library like the following.

final EntityResolver resolver = Scribe
    .defaultBuilder()
    .install(new NativeAnnotationsModule())
    .build();

final TypeSafeMapper mapper = new TypeSafeMapper(resolver);

Type initialization has to happen before serialization.

@Data
public class Foo {
    private final String field;
}

final StringEncoding<Foo> foo = mapper.stringEncodingFor(Foo.class);

At this point, you can now efficiently serialize or deserialize an instance of Foo.

final Foo instance = new Foo("hello world");
final String encoded = foo.encodeAsString(instance);
final Foo result = foo.decodeFromString(encoded);

assert result.equals(instance) == true;