diff options
Diffstat (limited to 'ant/ant14/com/vladium/emma/ant/NestedTask.java')
-rw-r--r-- | ant/ant14/com/vladium/emma/ant/NestedTask.java | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/ant/ant14/com/vladium/emma/ant/NestedTask.java b/ant/ant14/com/vladium/emma/ant/NestedTask.java new file mode 100644 index 0000000..cd2c0ad --- /dev/null +++ b/ant/ant14/com/vladium/emma/ant/NestedTask.java @@ -0,0 +1,66 @@ +/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. + * + * This program and the accompanying materials are made available under + * the terms of the Common Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/cpl-v10.html + * + * $Id: NestedTask.java,v 1.1.1.1.2.1 2004/07/08 10:52:10 vlad_r Exp $ + */ +package com.vladium.emma.ant; + +import com.vladium.util.IProperties; + +// ---------------------------------------------------------------------------- +/** + * @author Vlad Roubtsov, (C) 2003 + */ +public +abstract class NestedTask extends SuppressableTask +{ + // public: ................................................................ + + // protected: ............................................................. + + + protected NestedTask (final SuppressableTask parent) + { + if (parent == null) + throw new IllegalArgumentException ("null input: parent"); + + m_parent = parent; + } + + /** + * Overrides {@link SuppressableTask#getTaskSettings()} to mix in parent + * task settings as the base settings. + */ + protected final IProperties getTaskSettings () + { + final IProperties parentSettings = m_parent != null + ? m_parent.getTaskSettings () + : null; + + final IProperties taskOverrides = super.getTaskSettings (); + + // task settings are always more specific than parent settings, but attention + // needs to be paid to horizontal inheritance: + + if (parentSettings == null) + return taskOverrides; + else + { + final IProperties settings = IProperties.Factory.combine (taskOverrides, parentSettings); + + return settings; + } + } + + + protected final SuppressableTask m_parent; + + // package: ............................................................... + + // private: ............................................................... + +} // end of class +// ----------------------------------------------------------------------------
\ No newline at end of file |