001package com.plivo.api.xml; 002 003import com.plivo.api.exceptions.PlivoXmlException; 004import java.util.ArrayList; 005import java.util.List; 006import javax.xml.bind.annotation.XmlMixed; 007import javax.xml.bind.annotation.XmlRootElement; 008 009@XmlRootElement(name = "s") 010public class S extends PlivoXml implements LangNestable, 011 PNestable, 012 ProsodyNestable, 013 SpeakNestable { 014 015 @XmlMixed 016 private List<Object> mixedContent = new ArrayList<Object>(); 017 018 public S() { 019 } 020 021 public S(String content) { 022 this.mixedContent.add(content); 023 } 024 025 public S children(Object... nestables) throws PlivoXmlException { 026 for (Object obj : nestables) { 027 if (obj instanceof SNestable || obj instanceof String) { 028 mixedContent.add(obj); 029 } else { 030 throw new PlivoXmlException("XML Validation Error: <" + obj.getClass().getSimpleName() + "> can not be nested in <s>"); 031 } 032 } 033 return this; 034 } 035}