Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tiagobento/6d1d038a2e54dd4253ea9dcf15658928 to your computer and use it in GitHub Desktop.
Save tiagobento/6d1d038a2e54dd4253ea9dcf15658928 to your computer and use it in GitHub Desktop.
after
@ClientMarshaller(CustomMarshallerServicePojo.class)
@ServerMarshaller(CustomMarshallerServicePojo.class)
public class CustomMarshallerServicePojoMarshaller implements Marshaller<CustomMarshallerServicePojo> {
@Override
public CustomMarshallerServicePojo demarshall(EJValue o, MarshallingSession ctx) {
String[] split = o.isObject().get(SerializationParts.QUALIFIED_VALUE).isString().stringValue().split(",");
return new CustomMarshallerServicePojo(split[0], split[1]);
}
@Override
public String marshall(CustomMarshallerServicePojo o, MarshallingSession ctx) {
return "{ \"" + SerializationParts.ENCODED_TYPE + "\": \"" + CustomMarshallerServicePojo.class.getName() + "\", \""
+ SerializationParts.QUALIFIED_VALUE + "\": \"" + o.getFoo() + "," + o.getBar() + "\" }";
}
@Override
public CustomMarshallerServicePojo[] getEmptyArray() {
return new CustomMarshallerServicePojo[0];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment