esendex.sdk.java.model.domain.impl.MessageCollectionRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.everit.osgi.bundles.com.esendex.javasdk Show documentation
Show all versions of org.everit.osgi.bundles.com.esendex.javasdk Show documentation
The Esendex Java SDK is an easy to use client for our REST API that you can use to integrate SMS and Voice messaging into your Java application.
The newest version!
package esendex.sdk.java.model.domain.impl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import esendex.sdk.java.model.types.MessageType;
// TODO: Auto-generated Javadoc
/**
* The Class MessageCollectionRequest.
* @param the generic type
*/
public abstract class MessageCollectionRequest extends BaseMessageRequest implements Iterable {
private String accountReference;
private List messages;
/**
* Instantiates a new message collection request.
* @param account the esendex account
* @param messages the messages
* @param type the message type eg voice or sms
*/
public MessageCollectionRequest(
String account, List messages, MessageType type) {
super(type);
if (account == null || messages == null) throw new NullPointerException(
"'account' and 'messages' are required fields");
if (messages.isEmpty()) throw new IllegalArgumentException(
"'messages' must not be empty");
this.accountReference = account;
this.messages = messages;
}
/**
* Instantiates a new message collection request.
* @param account the account
* @param message the message
*/
public MessageCollectionRequest(
String account, T message, MessageType type) {
super(type);
if (account == null || message == null) throw new NullPointerException(
"'account' and 'message' are required fields");
List list = new ArrayList();
list.add(message);
this.accountReference = account;
this.messages = list;
}
public String getAccountReference() {
return accountReference;
}
public List getMessages() {
return messages;
}
public void setAccountReference(String accountReference) {
this.accountReference = accountReference;
}
public void setMessages(List messages) {
this.messages = messages;
}
@Override
public Iterator iterator() {
return messages.iterator();
}
/**
* {@inheritDoc}
*/
@Override
public String toString() {
return super.toString() +
"\naccountReference: " + accountReference +
"\nmessages: " + messages;
}
}