Created
July 24, 2017 20:56
-
-
Save tiagobento/6d1d038a2e54dd4253ea9dcf15658928 to your computer and use it in GitHub Desktop.
after
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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