KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * Copyright 2001-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 // This file is pulled from package org.apache.avalon.excalibur.cli Excalibur
17
// version 4.1 (Jan 30, 2002). Only the package name has been changed.
18
package org.apache.axis.utils;
19
20
21 /**
22  * Token handles tokenizing the CLI arguments
23  *
24  * @author <a HREF="mailto:peter@apache.org">Peter Donald</a>
25  * @author <a HREF="mailto:bloritsch@apache.org">Berin Loritsch</a>
26  * @since 4.0
27  */

28 class Token
29 {
30     /** Type for a separator token */
31     public static final int TOKEN_SEPARATOR = 0;
32     /** Type for a text token */
33     public static final int TOKEN_STRING = 1;
34
35     private final int m_type;
36     private final String JavaDoc m_value;
37
38     /**
39      * New Token object with a type and value
40      */

41     public Token( final int type, final String JavaDoc value )
42     {
43         m_type = type;
44         m_value = value;
45     }
46
47     /**
48      * Get the value of the token
49      */

50     public final String JavaDoc getValue()
51     {
52         return m_value;
53     }
54
55     /**
56      * Get the type of the token
57      */

58     public final int getType()
59     {
60         return m_type;
61     }
62
63     /**
64      * Convert to a string
65      */

66     public final String JavaDoc toString()
67     {
68         return new StringBuffer JavaDoc().append(m_type).append(":").append(m_value).toString();
69     }
70 }
71
Popular Tags