Java tutorial
/* * Copyright (c) 2004-2016 YAMJ Members * https://github.com/orgs/YAMJ/people * * This file is part of the Yet Another Movie Jukebox (YAMJ) project. * * YAMJ is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * YAMJ is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with YAMJ. If not, see <http://www.gnu.org/licenses/>. * * Web: https://github.com/YAMJ/yamj-v2 * */ package com.moviejukebox.model.attachment; import java.io.File; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlTransient; import javax.xml.bind.annotation.XmlType; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; /** * File attachment; * * @author modmax */ @XmlType public class Attachment { private AttachmentType type; private int attachmentId; private ContentType contentType; private String mimeType; private int part; // only relevant for video images private File sourceFile; @XmlElement public AttachmentType getType() { return type; } public void setType(AttachmentType type) { this.type = type; } @XmlElement public int getAttachmentId() { return attachmentId; } public void setAttachmentId(int attachmentId) { this.attachmentId = attachmentId; } @XmlElement public ContentType getContentType() { return contentType; } public void setContentType(ContentType contentType) { this.contentType = contentType; } @XmlElement public String getMimeType() { return mimeType; } public void setMimeType(String mimeType) { this.mimeType = mimeType; } @XmlElement public int getPart() { return part; } public void setPart(int part) { this.part = part; } @XmlTransient public File getSourceFile() { return sourceFile; } public void setSourceFile(File sourceFile) { this.sourceFile = sourceFile; } @Override public String toString() { return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append(attachmentId).append(contentType) .append(part).append(mimeType).toString(); } }