KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > modfact > jmi > api > EnumerationTypeInterfaceGenerator


1 /**
2  * copyright 2002 2004 Laboratoire d'Informatique Paris 6 (LIP6)
3  *
4  * This file is part of ModFact.
5  *
6  * ModFact is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * at your option) any later version.
10  *
11  * ModFact is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with ModFact; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */

20 package org.objectweb.modfact.jmi.api;
21
22 import javax.jmi.model.EnumerationType;
23 import javax.jmi.model.ModelElement;
24
25 import org.objectweb.modfact.jmi.generator.BracketGenerator;
26 import org.objectweb.modfact.jmi.helper.JMIProvider;
27 import org.objectweb.modfact.jmi.logging.ModFactLogger;
28
29
30 /**
31  * @author Xavier
32  *
33  */

34 public class EnumerationTypeInterfaceGenerator extends BracketGenerator {
35
36     EnumerationType[] input;
37
38     ModFactLogger logger;
39
40     /**
41      * Set Input
42      */

43     public void setInput(ModelElement[] elt) {
44         input = new EnumerationType[elt.length];
45         for (int i = 0; i < input.length; i++) {
46             input[i] = (EnumerationType) elt[i];
47         }
48     }
49
50     /**
51      * Set Trace
52      */

53     public void setLogger(ModFactLogger log) {
54         logger = log;
55     }
56
57     /**
58      * @see fr.lip6.modfact.generation.Generator#generate()
59      */

60     public void generate() {
61
62         int d = 0;
63         EnumerationType type = input[d];
64
65         outputln(
66             "package " + JMIProvider.qualifierOf(type) +";" );
67
68         outputln(
69             "public interface "
70                 + type.getName()
71                 + " extends javax.jmi.reflect.RefEnum {}");
72         flushFile();
73     }
74
75 }
76
Popular Tags