src Fix Manipulation<T> interface return type from String to T 6 months ago
.gitignore Initial commit 5 years ago
README.md Review and improve: fix typos, address code review findings, add missing tests, update README 6 months ago
TODO.md Review and improve: fix typos, address code review findings, add missing tests, update README 6 months ago
lombok.config Initial commit 5 years ago
pom.xml lombok version update 1 year ago
README.md

Transformer

Annotate member variables for transformation

public class User {
    @TransformDateFormat(from = "MM-dd-yyyy", to = "yyyy/MM/dd")
    private String date;
}

Instantiate

Transformer transformer = new Transformer(object);

Transform

transformer.transform();

Custom

Transforms against a custom class

@CustomTransformer(MyManipulation.class)

Required

  • value - Class that implements Manipulation

Note: Custom transformation class must implement the Manipulation interface and provide a public no-argument constructor.

Date Format

Change the format of a date string

@TransformDateFormat(from = "MM-dd-yyyy", to = "yyyy/MM/dd")

Data types supported

  • String

Format used by java.text.SimpleDateFormat

Base 64

Transforms to Base 64

@TransformToBase64

Data types supported

  • String

Errors

Reflection or configuration failures (unreadable fields, unwritable fields, or a @CustomTransformer value that is not a Manipulation or has no public no-argument constructor) are reported by throwing a io.ljunggren.transformer.exception.TransformerException.