Пример #1
0
  public Object createDynamicElement(String name) {
    if (kmSpec.matches(name)) {
      return createElem("name", kmSpec);
    } else if (ccSpec.matches(name)) {
      return createElem(new String[] {"name", "value"}, ccSpec);
    } else if (rsSpec.matches(name)) {
      return createElem("url", rsSpec);
    } else if (rslpSpec.matches(name)) {
      RuntimeSharedLibraryPath runtimeSharedLibraryPath = new RuntimeSharedLibraryPath();
      nestedAttribs.add(runtimeSharedLibraryPath);
      return runtimeSharedLibraryPath;
    } else if (lcSpec.matches(name)) {
      return createElem("filename", lcSpec);
    } else if (spSpec.matches(name)) {
      return createElem("path-element", spSpec);
    } else if (DefaultScriptLimits.spec.matches(name)) {
      if (dLimits == null) return dLimits = new DefaultScriptLimits();
      else
        throw new BuildException(
            "Only one nested <default-script-limits> element is allowed in an <mxmlc> task.");
    } else if (DefaultSize.spec.matches(name)) {
      if (dSize == null) return dSize = new DefaultSize();
      else
        throw new BuildException(
            "Only one nested <default-size> element is allowed in an <mxmlc> task.");
    } else if (elSpec.matches(name)) {
      FlexFileSet fs = new FlexFileSet(elSpec, true);
      nestedFileSets.add(fs);
      return fs;
    } else if (ilSpec.matches(name)) {
      FlexFileSet fs = new FlexFileSet(ilSpec, true);
      nestedFileSets.add(fs);
      return fs;
    } else if (lpSpec.matches(name)) {
      FlexFileSet fs = new FlexFileSet(lpSpec, true);
      nestedFileSets.add(fs);
      return fs;
    } else if (thSpec.matches(name)) {
      FlexFileSet fs = new FlexFileSet(thSpec);
      nestedFileSets.add(fs);
      return fs;
    } else if (irSpec.matches(name)) {
      return createElem("bundle", irSpec);
    }

    return super.createDynamicElement(name);
  }
Пример #2
0
 public Object createDynamicElement(String name) {
   /*
    * Name is checked against getAlias() because both of these options
    * have prefixes. We don't want to allow something like:
    *
    * <metadata>
    *   <metadata.localized-title title="foo" lang="en" />
    * </metadata>
    */
   if (ldSpec.matches(name)) {
     return createElem(new String[] {"text", "lang"}, ldSpec);
   } else if (ltSpec.matches(name)) {
     return createElem(new String[] {"title", "lang"}, ltSpec);
   } else {
     throw new BuildException("Invalid element: " + name);
   }
 }