summaryrefslogtreecommitdiff
path: root/ant/ant14/com/vladium/emma/ant/StringValue.java
blob: 454c2ce8d7603fe3a9f8ee83bfaab2d173f6e09e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/* 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: StringValue.java,v 1.2 2004/05/20 02:28:06 vlad_r Exp $
 */
package com.vladium.emma.ant;

import org.apache.tools.ant.Task;

// ----------------------------------------------------------------------------
/**
 * @author Vlad Roubtsov, (C) 2003
 */
public
abstract class StringValue
{
    // public: ................................................................
    
    
    public void appendValue (final String value, final String separator)
    {
        if ((value != null) && (value.length () > 0))
        {
            if (m_value == null)
            {
                m_value = new StringBuffer (value); 
            }
            else
            {
                m_value.append (separator);
                m_value.append (value); // no trailing separator kept
            }
        }
    }
                
    public String getValue ()
    {
        return m_value != null ? m_value.toString () : null;  
    }
    
    // protected: .............................................................
    
    
    protected StringValue (final Task task)
    {
        if (task == null) throw new IllegalArgumentException ("null input: task");
        
        m_task = task;
    }


    protected final Task m_task;
    
    // package: ...............................................................
    
    // private: ...............................................................

    
    private StringBuffer m_value;

} // end of class
// ----------------------------------------------------------------------------