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

com.plivo.api.xml.S Maven / Gradle / Ivy

Go to download

A Java SDK to make voice calls & send SMS using Plivo and to generate Plivo XML

There is a newer version: 5.46.0
Show newest version
package com.plivo.api.xml;

import com.plivo.api.exceptions.PlivoXmlException;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlMixed;
import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement(name = "s")
public class S extends PlivoXml implements LangNestable,
                                           PNestable,
                                           ProsodyNestable,
                                           SpeakNestable {

  @XmlMixed
  private List mixedContent = new ArrayList();

  public S() {
  }

  public S(String content) {
    this.mixedContent.add(content);
  }

  public S children(Object... nestables) throws PlivoXmlException {
    for (Object obj : nestables) {
      if (obj instanceof SNestable || obj instanceof String) {
        mixedContent.add(obj);
      } else {
        throw new PlivoXmlException("XML Validation Error: <" + obj.getClass().getSimpleName() + "> can not be nested in ");
      }
    }
    return this;
  }
}