| src | 6 months ago | ||
| .gitignore | 5 years ago | ||
| README.md | 6 months ago | ||
| lombok.config | 5 years ago | ||
| pom.xml | 6 months ago | ||
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();
Transforms against a custom class
@CustomTransformer(MyManipulation.class)
Required
Note: Custom transformation class must implement the Manipulation interface and provide a public no-argument constructor.
Change the format of a date string
@TransformDateFormat(from = "MM-dd-yyyy", to = "yyyy/MM/dd")
Data types supported
Format used by java.text.SimpleDateFormat
Transforms to Base 64
@TransformToBase64
Data types supported
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.