home | career | drupal | java | mac | mysql | perl | scala | uml | unix

Groovy example source code file (SpoofTaskContainer.java)

This example Groovy source code file (SpoofTaskContainer.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

arraylist, buildexception, iterator, list, spooftaskcontainer, spooftaskcontainer, stringbuffer, stringbuffer, task, task, taskcontainer, unknownelement, unknownelement, util

The Groovy SpoofTaskContainer.java source code

package groovy.util;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.TaskContainer;
import org.apache.tools.ant.UnknownElement;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class SpoofTaskContainer extends Task implements TaskContainer {
    private List tasks = new ArrayList();
    static StringBuffer spoof = new StringBuffer();

    public SpoofTaskContainer() {
        spoof("SpoofTaskContainer ctor");

    static StringBuffer getSpoof() {
        return spoof;

    static void resetSpoof() {
        spoof = new StringBuffer();

    static void spoof(String message) {

    public void addTask(Task task) {
        // to work with ant 1.6
        spoof("in addTask");
        if (task instanceof UnknownElement) {
            spoof("configuring UnknownElement");
            task = ((UnknownElement) task).getTask();

    public void execute() throws BuildException {
        spoof("begin SpoofTaskContainer execute");
        for (Iterator iter = tasks.iterator(); iter.hasNext();) {
            Task task = (Task) iter.next();
        spoof("end SpoofTaskContainer execute");


Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy SpoofTaskContainer.java source code file:

new blog posts


Copyright 1998-2014 Alvin Alexander, alvinalexander.com
All Rights Reserved.