|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
FormatEnum.java | 100% | 100% | 100% | 100% |
|
1 |
/*
|
|
2 |
* Copyright (C) The MetaClass Group. All rights reserved.
|
|
3 |
*
|
|
4 |
* This software is published under the terms of the Spice
|
|
5 |
* Software License version 1.1, a copy of which has been included
|
|
6 |
* with this distribution in the LICENSE.txt file.
|
|
7 |
*/
|
|
8 |
package org.codehaus.metaclass.tools.tasks;
|
|
9 |
|
|
10 |
import org.apache.tools.ant.types.EnumeratedAttribute;
|
|
11 |
|
|
12 |
/**
|
|
13 |
* This is an enumeration that gives the option of either outputting as xml or
|
|
14 |
* as a serialized format.
|
|
15 |
*
|
|
16 |
* @author <a href="mailto:peter at apache.org">Peter Donald</a>
|
|
17 |
* @version $Revision: 1.6 $ $Date: 2003/12/11 08:41:50 $
|
|
18 |
*/
|
|
19 |
public class FormatEnum |
|
20 |
extends EnumeratedAttribute
|
|
21 |
{ |
|
22 |
/**
|
|
23 |
* Return type code for format.
|
|
24 |
*
|
|
25 |
* @return the typecode
|
|
26 |
*/
|
|
27 | 26 |
public int getTypeCode() |
28 |
{ |
|
29 | 26 |
final String value = super.getValue();
|
30 | 26 |
if( value.equals( "class" ) ) |
31 |
{ |
|
32 | 2 |
return GenerateClassDescriptorsTask.CLASS_TYPE;
|
33 |
} |
|
34 | 24 |
else if( value.equals( "binary" ) ) |
35 |
{ |
|
36 | 16 |
return GenerateClassDescriptorsTask.BINARY_TYPE;
|
37 |
} |
|
38 |
else
|
|
39 |
{ |
|
40 | 8 |
return GenerateClassDescriptorsTask.XML_TYPE;
|
41 |
} |
|
42 |
} |
|
43 |
|
|
44 |
/**
|
|
45 |
* Return the set of valid values.
|
|
46 |
*
|
|
47 |
* @return the set of valid values.
|
|
48 |
*/
|
|
49 | 28 |
public String[] getValues()
|
50 |
{ |
|
51 | 28 |
return new String[]{"xml", "binary", "class"}; |
52 |
} |
|
53 |
} |
|
54 |
|
|