diff options
author | Alex Clayton <alex.clayton@isode.com> | 2016-02-02 11:26:01 (GMT) |
---|---|---|
committer | Alex Clayton <alex.clayton@isode.com> | 2016-02-04 10:09:21 (GMT) |
commit | be72c822d3cffd840e753e01fe28857b081cf6f3 (patch) | |
tree | ae3fe8fe22175f9bfee89f0688b71ca377f7f1e9 /src/com/isode/stroke/elements/AbstractBlockPayload.java | |
parent | 2c9305a872e4ca958bfd86472c4540cc10d11a2f (diff) | |
download | stroke-be72c822d3cffd840e753e01fe28857b081cf6f3.zip stroke-be72c822d3cffd840e753e01fe28857b081cf6f3.tar.bz2 |
Add Block Parser and Serializer
Add BlockParser and BlockSerializer for the block payload classes.
This required slightly different approach to the Swiften code as C++ templates
are different to Java generics. In short needed to add a type hierachy to the
Block payload classes and to the Parsers and Serilaizers associated with them.
Test-information:
Ran unit tests everything passed ok.
Change-Id: I3ea2d66afd7cb3b5c4c3515be3a1ef99d7dbb566
Diffstat (limited to 'src/com/isode/stroke/elements/AbstractBlockPayload.java')
-rw-r--r-- | src/com/isode/stroke/elements/AbstractBlockPayload.java | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/com/isode/stroke/elements/AbstractBlockPayload.java b/src/com/isode/stroke/elements/AbstractBlockPayload.java new file mode 100644 index 0000000..575b6ba --- /dev/null +++ b/src/com/isode/stroke/elements/AbstractBlockPayload.java @@ -0,0 +1,49 @@ +/* Copyright (c) 2016, Isode Limited, London, England. + * All rights reserved. + * + * Acquisition and use of this software and related materials for any + * purpose requires a written license agreement from Isode Limited, + * or a written license from an organisation licensed by Isode Limited + * to grant such a license. + * + */ +package com.isode.stroke.elements; + +import java.util.Vector; + +import com.isode.stroke.jid.JID; + +/** + * Parent abstract class for the Block pay load classes {@link BlockPayload}, + * {@link BlockListPayload} and {@link UnblockPayload}. + */ +public abstract class AbstractBlockPayload extends Payload { + /* + * Note this is slightly different to Swiften code as templates in C++ work + * different to Java Generics. In Swiften there exits a BlockParser template + * for which instances can be created of type <BlockPayload>, <BlockListPayload> and + * <UnblockPayload>. To get this to work in java we have to create a parent + * abstract class for all these Block elements types. + */ + + + /** + * Constructor + */ + protected AbstractBlockPayload() { + super(); + } + + /** + * Adds an item + * @param item item, not {@code null} + */ + public abstract void addItem(JID item); + + /** + * Gets the items + * @return items, NotNull. + */ + public abstract Vector<JID> getItems(); + +} |