All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.bloodshura.sparkium.mail.component.Message Maven / Gradle / Ivy

Go to download

An API which aims to facilitate the usage of javax.mail, also including other mailing services.

The newest version!
package com.github.bloodshura.sparkium.mail.component;

import com.github.bloodshura.ignitium.collection.list.XList;
import com.github.bloodshura.ignitium.collection.list.impl.XArrayList;
import com.github.bloodshura.ignitium.collection.view.XBasicView;
import com.github.bloodshura.ignitium.collection.view.XSnapshotView;
import com.github.bloodshura.ignitium.collection.view.XView;
import com.github.bloodshura.ignitium.io.File;
import com.github.bloodshura.ignitium.object.Base;
import com.github.bloodshura.ignitium.object.Mutable;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

@Mutable
public class Message extends Base {
	private final XList attachments;
	private XView content;
	private String subject;

	public Message() {
		this.attachments = new XArrayList<>();
		this.content = new XBasicView<>();
	}

	@Nonnull
	public XList getAttachments() {
		return attachments;
	}

	@Nonnull
	public XView getContent() {
		return content;
	}

	@Nullable
	public String getSubject() {
		return subject;
	}

	public boolean hasAttachments() {
		return !getAttachments().isEmpty();
	}

	public void setContent(@Nonnull Iterable content) {
		setContent(new XSnapshotView<>(content));
	}

	public void setContent(@Nonnull String... content) {
		setContent(new XSnapshotView<>(content));
	}

	public void setContent(@Nonnull XView content) {
		this.content = content;
	}

	public void setSubject(@Nullable String subject) {
		this.subject = subject;
	}

	@Nonnull
	@Override
	protected Object[] stringValues() {
		return new Object[] { getContent(), getSubject() };
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy