Java annotation to transform a json field -
i trying come interface has pretty non-standard way of representing fields fed legacy system, interface seems require custom validations + transformations such
- truncating string value beyond specified length (example : in cases truncate string beyond 25th character, in other cases truncate beyond 15th character)
- validate string date field of format
yyymmdd
, transforming date field ofyyyy-mm-dd
format in setter
how come custom annotations can using @interface
? able find @constraint(validatedby=someclass.class)
there doesn't seem transform data (or sorry if haven't looked enough).. pointers on helpful.
in java, use "transformed" datatype in jackson annotated objects, example:
private transformeddata data;
then configure jackson deserializer accepts string , returns "transformeddata" object. when jackson trying fill in data field, notice needs conversion , call deserializer.
Comments
Post a Comment