001package org.codemonkey.simplejavamail; 002 003import javax.activation.DataSource; 004 005/** 006 * A named immutable email attachment information object. The name can be a simple name, a filename or a named embedded 007 * image (eg. <cid:footer>). Contains a {@link DataSource} that is compatible with the javax.mail API. 008 * 009 * @author Benny Bottema 010 * @see DataSource 011 */ 012final class AttachmentResource { 013 014 /** 015 * @see #AttachmentResource(String, DataSource) 016 */ 017 private final String name; 018 019 /** 020 * @see #AttachmentResource(String, DataSource) 021 */ 022 private final DataSource dataSource; 023 024 /** 025 * Constructor; initializes the attachment resource with a name and data. 026 * 027 * @param name The name of the attachment which can be a simple name, a filename or a named embedded image (eg. 028 * <cid:footer>) 029 * @param dataSource The attachment data. 030 * @see DataSource 031 */ 032 public AttachmentResource(final String name, final DataSource dataSource) { 033 this.name = name; 034 this.dataSource = dataSource; 035 } 036 037 /** 038 * Bean getter for {@link #dataSource}. 039 */ 040 public DataSource getDataSource() { 041 return dataSource; 042 } 043 044 /** 045 * Bean getter for {@link #name}. 046 */ 047 public String getName() { 048 return name; 049 } 050}