Java Code Examples for org.xembly.Directives#add()

The following examples show how to use org.xembly.Directives#add() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XmlMethodDef.java    From eo with MIT License 6 votes vote down vote up
@Override
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
public Iterator<Directive> iterator() {
    final Directives dir = new Directives()
        .add("method")
        .attr("name", this.name)
        .add("type")
        .attr("name", this.type)
        .up();
    dir.add("params");
    for (final Parameter param : this.params) {
        dir.append(param.xml());
    }
    dir.up();
    return dir.up().iterator();
}
 
Example 2
Source File: XmlTypeDef.java    From eo with MIT License 6 votes vote down vote up
@Override
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
public Iterator<Directive> iterator() {
    final Directives dir = new Directives().add("type")
        .attr("name", this.name);
    dir.add("super");
    for (final String type : this.spr) {
        dir.add("type").attr("name", type).up();
    }
    dir.up();
    dir.add("methods");
    for (final Method method : this.methods) {
        dir.append(method.xml());
    }
    dir.up();
    return dir.up().iterator();
}
 
Example 3
Source File: OozieWorkflowGenerator.java    From arbiter with Apache License 2.0 6 votes vote down vote up
/**
 * Add the configuration element for a workflow action
 *
 * @param properties The configuration properties
 * @param directives The Xembly Directives object to which to add the new XML elements
 */
private void createConfigurationElement(Map<String, String> properties, Directives directives) {
    if (properties == null) {
        return;
    }

    directives.add("configuration");

    for (Map.Entry<String, String> entry : properties.entrySet()) {
        directives.add("property")
                .add("name")
                .set(entry.getKey())
                .up()
                .add("value")
                .set(entry.getValue())
                .up()
                .up();
    }
    directives.up();
}
 
Example 4
Source File: ObjectBody.java    From eo with MIT License 5 votes vote down vote up
/**
 * As XML.
 * @return Directives
 */
public Iterable<Directive> xml() {
    final Directives dir = new Directives();
    dir.add("attributes");
    for (final Attribute attr : this.attrs) {
        dir.append(attr.xml());
    }
    return dir;
}
 
Example 5
Source File: Object.java    From eo with MIT License 5 votes vote down vote up
@Override
@SuppressWarnings("PMD.AvoidDuplicateLiterals")
public Iterable<Directive> xml() {
    final Directives dir = new Directives()
        .add("object")
        .attr("name", this.name);
    dir.add("types");
    for (final String type : this.types) {
        dir.add("type").attr("name", type).up();
    }
    dir.up();
    dir.append(this.body.xml());
    return dir.up();
}