KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > axis > utils > Token


1 /*
2  * Copyright (C) The Apache Software Foundation. All rights reserved.
3  *
4  * This software is published under the terms of the Apache Software License
5  * version 1.1, a copy of which has been included with this distribution in
6  * the docs/licenses/apache-1.1.txt file.
7  */

8 // This file is pulled from package org.apache.avalon.excalibur.cli Excalibur
9
// version 4.1 (Jan 30, 2002). Only the package name has been changed.
10
package org.jboss.axis.utils;
11
12
13 /**
14  * Token handles tokenizing the CLI arguments
15  *
16  * @author <a HREF="mailto:peter@apache.org">Peter Donald</a>
17  * @author <a HREF="mailto:bloritsch@apache.org">Berin Loritsch</a>
18  * @since 4.0
19  */

20 class Token
21 {
22    /**
23     * Type for a separator token
24     */

25    public static final int TOKEN_SEPARATOR = 0;
26    /**
27     * Type for a text token
28     */

29    public static final int TOKEN_STRING = 1;
30
31    private final int m_type;
32    private final String JavaDoc m_value;
33
34    /**
35     * New Token object with a type and value
36     */

37    public Token(final int type, final String JavaDoc value)
38    {
39       m_type = type;
40       m_value = value;
41    }
42
43    /**
44     * Get the value of the token
45     */

46    public final String JavaDoc getValue()
47    {
48       return m_value;
49    }
50
51    /**
52     * Get the type of the token
53     */

54    public final int getType()
55    {
56       return m_type;
57    }
58
59    /**
60     * Convert to a string
61     */

62    public final String JavaDoc toString()
63    {
64       return new StringBuffer JavaDoc().append(m_type).append(":").append(m_value).toString();
65    }
66 }
67
Popular Tags