package envoy.data; import java.io.Serializable; /** * This interface should be used for any type supposed to be a {@link Message} attachment (i.e. * images or sound). * * @author Leon Hofmeister * @author Kai S. K. Engelbart * @since Envoy Common v0.2-alpha */ public final class Attachment implements Serializable { /** * Defines the type of the attachment. * * @since Envoy Common v0.1-beta */ public enum AttachmentType { /** * This attachment type denotes a picture. * * @since Envoy Common v0.1-beta */ PICTURE, /** * This attachment type denotes a video. * * @since Envoy Common v0.1-beta */ VIDEO, /** * This attachment type denotes a voice message. * * @since Envoy Common v0.1-beta */ VOICE, /** * This attachment type denotes a document. * * @since Envoy Common v0.1-beta */ DOCUMENT } private final byte[] data; private final AttachmentType type; private final String name; private static final long serialVersionUID = 2L; /** * Constructs an attachment. * * @param data the data of the attachment * @param name the name of the attachment * @param type the type of the attachment * @since Envoy Common v0.1-beta */ public Attachment(byte[] data, String name, AttachmentType type) { this.data = data; this.name = name; this.type = type; } /** * @return the data of the attachment * @since Envoy Common v0.1-beta */ public byte[] getData() { return data; } /** * @return the type of the attachment * @since Envoy Common v0.1-beta */ public AttachmentType getType() { return type; } /** * @return the name * @since Envoy Common v0.2-beta */ public String getName() { return name; } }