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

Groovy example source code file (

This example Groovy source code file ( is included in the "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 source code

package groovy.util;


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);
        spoof("end SpoofTaskContainer execute");


Other Groovy examples (source code examples)

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

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller


new blog posts


Copyright 1998-2021 Alvin Alexander,
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.