1/* Copyright (C) 2003 Vladimir Roubtsov. All rights reserved. 2 * 3 * This program and the accompanying materials are made available under 4 * the terms of the Common Public License v1.0 which accompanies this distribution, 5 * and is available at http://www.eclipse.org/legal/cpl-v10.html 6 * 7 * $Id: NestedTask.java,v 1.1.1.1.2.1 2004/07/08 10:52:10 vlad_r Exp $ 8 */ 9package com.vladium.emma.ant; 10 11import com.vladium.util.IProperties; 12 13// ---------------------------------------------------------------------------- 14/** 15 * @author Vlad Roubtsov, (C) 2003 16 */ 17public 18abstract class NestedTask extends SuppressableTask 19{ 20 // public: ................................................................ 21 22 // protected: ............................................................. 23 24 25 protected NestedTask (final SuppressableTask parent) 26 { 27 if (parent == null) 28 throw new IllegalArgumentException ("null input: parent"); 29 30 m_parent = parent; 31 } 32 33 /** 34 * Overrides {@link SuppressableTask#getTaskSettings()} to mix in parent 35 * task settings as the base settings. 36 */ 37 protected final IProperties getTaskSettings () 38 { 39 final IProperties parentSettings = m_parent != null 40 ? m_parent.getTaskSettings () 41 : null; 42 43 final IProperties taskOverrides = super.getTaskSettings (); 44 45 // task settings are always more specific than parent settings, but attention 46 // needs to be paid to horizontal inheritance: 47 48 if (parentSettings == null) 49 return taskOverrides; 50 else 51 { 52 final IProperties settings = IProperties.Factory.combine (taskOverrides, parentSettings); 53 54 return settings; 55 } 56 } 57 58 59 protected final SuppressableTask m_parent; 60 61 // package: ............................................................... 62 63 // private: ............................................................... 64 65} // end of class 66// ----------------------------------------------------------------------------