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: StringValue.java,v 1.2 2004/05/20 02:28:06 vlad_r Exp $ 8 */ 9package com.vladium.emma.ant; 10 11import org.apache.tools.ant.Task; 12 13// ---------------------------------------------------------------------------- 14/** 15 * @author Vlad Roubtsov, (C) 2003 16 */ 17public 18abstract class StringValue 19{ 20 // public: ................................................................ 21 22 23 public void appendValue (final String value, final String separator) 24 { 25 if ((value != null) && (value.length () > 0)) 26 { 27 if (m_value == null) 28 { 29 m_value = new StringBuffer (value); 30 } 31 else 32 { 33 m_value.append (separator); 34 m_value.append (value); // no trailing separator kept 35 } 36 } 37 } 38 39 public String getValue () 40 { 41 return m_value != null ? m_value.toString () : null; 42 } 43 44 // protected: ............................................................. 45 46 47 protected StringValue (final Task task) 48 { 49 if (task == null) throw new IllegalArgumentException ("null input: task"); 50 51 m_task = task; 52 } 53 54 55 protected final Task m_task; 56 57 // package: ............................................................... 58 59 // private: ............................................................... 60 61 62 private StringBuffer m_value; 63 64} // end of class 65// ----------------------------------------------------------------------------