1 23 24 package org.enhydra.xml.xmlc.metadata; 25 26 import java.util.ArrayList ; 27 28 import org.w3c.dom.Document ; 29 30 33 public class JavaCompilerSection extends MetaDataElement { 34 37 public static final String TAG_NAME = "javaCompiler"; 38 39 42 private static final String JAVAC_ATTR = "javac"; 43 44 47 public static final String DEFAULT_JAVAC = "javac"; 48 49 52 public JavaCompilerSection(Document ownerDoc) { 53 super(ownerDoc, TAG_NAME); 54 } 55 56 59 public String getJavac() { 60 String javac = getAttributeNull(JAVAC_ATTR); 61 if (javac == null) { 62 return DEFAULT_JAVAC; 63 } else { 64 return javac; 65 } 66 } 67 68 71 public void setJavac(String value) { 72 setAttribute(JAVAC_ATTR, value); 73 } 74 75 78 public boolean isJavacSpecified() { 79 return isAttributeSpecified(JAVAC_ATTR); 80 } 81 82 85 public JavacOption[] getJavacOptions() { 86 return (JavacOption[])getChildren(JavacOption.class); 87 } 88 89 92 public void addJavacOption(JavacOption javacOption) { 93 appendChild(javacOption); 94 } 95 96 99 public JavacOption addJavacOption() { 100 JavacOption javacOption = new JavacOption(getOwnerDocument()); 101 appendChild(javacOption); 102 return javacOption; 103 } 104 105 108 public void deleteJavacOption(JavacOption javacOption) { 109 removeChild(javacOption); 110 } 111 112 116 public void deleteJavacOption(String optionName) { 117 JavacOption[] options = getJavacOptions(); 118 for (int idx = 0; idx < options.length; idx++) { 119 if (options[idx].getName().equals(optionName)) { 120 removeChild(options[idx]); 121 } 122 } 123 } 124 125 128 public String [] getJavacArgs() { 129 ArrayList args = new ArrayList (); 130 131 JavacOption[] options = getJavacOptions(); 132 for (int idx = 0; idx < options.length; idx++) { 133 args.add(options[idx].getName()); 134 String value = options[idx].getValue(); 135 if (value != null) { 136 args.add(value); 137 } 138 } 139 return (String [])args.toArray(new String [args.size()]); 140 } 141 } 142 | Popular Tags |