diff options
author | Alex Clayton <alex.clayton@isode.com> | 2014-08-19 12:54:52 (GMT) |
---|---|---|
committer | Alex Clayton <alex.clayton@isode.com> | 2014-08-19 14:23:15 (GMT) |
commit | 768ec40ad0229804ca1dcc06dc9cdc7c8dab9769 (patch) | |
tree | a8b6acd5d0527066700c23b0e7a10dfd643c371b /src/com/isode | |
parent | c0293fade7b437e5687e7121c9f6b9de7344ad47 (diff) | |
download | stroke-768ec40ad0229804ca1dcc06dc9cdc7c8dab9769.zip stroke-768ec40ad0229804ca1dcc06dc9cdc7c8dab9769.tar.bz2 |
Add SubjectSerializer
Add a SubjectSerializer to Stroke.
Test-information:
Created a Message object and set its subject. Subject field now turns up in the XMMP telemetry.
Change-Id: I7b310d6dc52852e5704696e5e3762bed6a4d53ad
Diffstat (limited to 'src/com/isode')
-rw-r--r-- | src/com/isode/stroke/serializer/payloadserializers/FullPayloadSerializerCollection.java | 2 | ||||
-rw-r--r-- | src/com/isode/stroke/serializer/payloadserializers/SubjectSerializer.java | 22 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/com/isode/stroke/serializer/payloadserializers/FullPayloadSerializerCollection.java b/src/com/isode/stroke/serializer/payloadserializers/FullPayloadSerializerCollection.java index 9cb3646..ee8ad05 100644 --- a/src/com/isode/stroke/serializer/payloadserializers/FullPayloadSerializerCollection.java +++ b/src/com/isode/stroke/serializer/payloadserializers/FullPayloadSerializerCollection.java @@ -22,7 +22,7 @@ public class FullPayloadSerializerCollection extends PayloadSerializerCollection /*FIXME: Implement what's needed. */ //addSerializer(new IBBSerializer()); addSerializer(new BodySerializer()); - //addSerializer(new SubjectSerializer()); + addSerializer(new SubjectSerializer()); //addSerializer(new ChatStateSerializer()); //addSerializer(new PrioritySerializer()); addSerializer(new ErrorSerializer()); diff --git a/src/com/isode/stroke/serializer/payloadserializers/SubjectSerializer.java b/src/com/isode/stroke/serializer/payloadserializers/SubjectSerializer.java new file mode 100644 index 0000000..885d86c --- /dev/null +++ b/src/com/isode/stroke/serializer/payloadserializers/SubjectSerializer.java @@ -0,0 +1,22 @@ +package com.isode.stroke.serializer.payloadserializers; + +import com.isode.stroke.elements.Subject; +import com.isode.stroke.serializer.GenericPayloadSerializer; +import com.isode.stroke.serializer.xml.XMLTextNode; + +/** + * Subject to String + */ +public class SubjectSerializer extends GenericPayloadSerializer<Subject> { + + public SubjectSerializer() { + super(Subject.class); + } + + @Override + protected String serializePayload(Subject payload) { + XMLTextNode textNode = new XMLTextNode(payload.getText()); + return "<subject>"+textNode.serialize()+"</subject>"; + } + +} |