KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tools > ant > types > FlexInteger


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

18
19 package org.apache.tools.ant.types;
20
21 /**
22  * Helper class which can be used for Ant task attribute setter methods to allow
23  * the build file to specify an integer in either decimal, octal, or hexadecimal
24  * format.
25  *
26  * @see java.lang.Integer#decode(String)
27  */

28 public class FlexInteger {
29     private Integer JavaDoc value;
30
31     /**
32      * Constructor used by Ant's introspection mechanism for attribute population
33      * @param value the value to decode
34      */

35     public FlexInteger(String JavaDoc value) {
36         this.value = Integer.decode(value);
37     }
38
39     /**
40      * Returns the decimal integer value
41      * @return the integer value
42      */

43     public int intValue() {
44         return value.intValue();
45     }
46
47     /**
48      * Overridden method to return the decimal value for display
49      * @return a string version of the integer
50      */

51     public String JavaDoc toString() {
52         return value.toString();
53     }
54 }
55
Popular Tags