All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javaposse.jobdsl.dsl.helpers.AbstractHelper.groovy Maven / Gradle / Ivy

There is a newer version: 1.22-rxd-2
Show newest version
package javaposse.jobdsl.dsl.helpers

import javaposse.jobdsl.dsl.JobType
import javaposse.jobdsl.dsl.WithXmlAction

/**
 * Base for all helpers, providing an easy ability to create WithXmlActions
 */
public class AbstractHelper implements Helper {

    /**
     * Global list of all withXmlActions. Helper should append to it as they get called. They could prepend to the list,
     * that is not advised. They can scan the list so fat to look special implementations of WithXmlAction, which might
     * effect their behavior.
     */
    List withXmlActions

    JobType type

    AbstractHelper(List withXmlActions, JobType type) {
        this.withXmlActions = withXmlActions
        this.type = type
    }


    WithXmlAction execute(Closure rootClosure) {
        rootClosure.resolveStrategy = Closure.DELEGATE_FIRST
        def action = new WithXmlAction(rootClosure)
        withXmlActions << action
        return action
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy