1 package net.firstpartners.nounit.snippet; 2 3 26 27 import java.util.Iterator ; 28 29 import net.firstpartners.nounit.snippet.xml.IXmlConstants; 30 import net.firstpartners.nounit.snippet.xml.IXmlJdomSource; 31 import net.firstpartners.nounit.snippet.xml.IXmlSource; 32 33 import org.jdom.Element; 34 35 38 public class SnippetProject extends AbstractSnippet 39 implements IXmlSource, IXmlJdomSource, IXmlConstants { 40 41 44 private Snippets innerPackages; 45 46 50 public SnippetProject(Snippets packages) { 51 52 this.innerPackages = packages; 53 } 54 55 56 60 public String toString(){ 61 62 StringBuffer stringDescription = new StringBuffer (); 64 65 stringDescription.append("Project: "); 67 stringDescription.append("\n"); 68 69 Iterator packageValues = this.innerPackages.getIterator(); 71 72 while (packageValues.hasNext()){ 73 74 stringDescription.append("\n"); 75 stringDescription.append(packageValues.next()); 76 stringDescription.append("\n"); 77 78 } 79 80 82 return stringDescription.toString(); 83 } 84 85 89 public String toXml() { 90 91 return super.toXml(getNodes()); 92 93 } 94 95 96 100 public Element getNodes(){ 101 102 Element projectRoot = new Element(ELEMENT_PROJECT); 104 105 projectRoot = innerPackages.addNodesTo(projectRoot); 107 108 return projectRoot; 110 111 } 112 113 } 114 | Popular Tags |