KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > generation > mivisitor > MetaInfoVisitorImpl


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

18 package org.objectweb.speedo.generation.mivisitor;
19
20 import org.objectweb.speedo.generation.api.SpeedoCompilerParameter;
21 import org.objectweb.speedo.api.SpeedoException;
22 import org.objectweb.speedo.metadata.SpeedoXMLDescriptor;
23 import org.objectweb.speedo.metadata.SpeedoPackage;
24 import org.objectweb.speedo.metadata.SpeedoClass;
25 import org.objectweb.speedo.metadata.SpeedoField;
26 import org.objectweb.speedo.metadata.SpeedoExtension;
27 import org.objectweb.speedo.metadata.SpeedoElement;
28
29 import java.util.Iterator JavaDoc;
30
31 /**
32  *
33  * @author S.Chassande-Barrioz
34  */

35 public class MetaInfoVisitorImpl extends AbstractMetaInfoVisitor {
36
37     /**
38      * builds a MetaInfoVisitor which is the last of the chain
39      */

40     public MetaInfoVisitorImpl() {
41     }
42
43     /**
44      * builds a MetaInfoVisitor which is the last of the chain
45      */

46     public MetaInfoVisitorImpl(MetaInfoVisitor mim) {
47         super(mim);
48     }
49
50     public void visitCompilerParameter(SpeedoCompilerParameter scp) throws SpeedoException {
51         super.visitCompilerParameter(scp);
52         Iterator JavaDoc xmlIt = scp.getXmldescriptor().values().iterator();
53         while(xmlIt.hasNext()) {
54             SpeedoXMLDescriptor xml = (SpeedoXMLDescriptor) xmlIt.next();
55             visitXml(xml);
56         }
57     }
58
59     public void visitXml(SpeedoXMLDescriptor xml) throws SpeedoException {
60         super.visitXml(xml);
61         Iterator JavaDoc packIt = xml.jdoPackage.values().iterator();
62         while(packIt.hasNext()) {
63             SpeedoPackage pack = (SpeedoPackage) packIt.next();
64             visitPackage(pack);
65         }
66     }
67
68     public void visitPackage(SpeedoPackage sp) throws SpeedoException {
69         super.visitPackage(sp);
70         visitExtension(sp);
71         Iterator JavaDoc classIt = sp.jdoClass.values().iterator();
72         while(classIt.hasNext()) {
73             SpeedoClass clazz = (SpeedoClass) classIt.next();
74             visitClass(clazz);
75         }
76     }
77
78     public void visitClass(SpeedoClass sc) throws SpeedoException {
79         super.visitClass(sc);
80         visitExtension(sc);
81         Iterator JavaDoc fieldIt = sc.jdoField.values().iterator();
82         while(fieldIt.hasNext()) {
83             SpeedoField sf = (SpeedoField) fieldIt.next();
84             visitField(sf);
85         }
86     }
87
88     public void visitField(SpeedoField sf) throws SpeedoException {
89         visitExtension(sf);
90         super.visitField(sf);
91     }
92
93     private void visitExtension(SpeedoElement se) throws SpeedoException {
94         for(int i=0; i<se.jdoExtension.size(); i++) {
95             super.visitExtension((SpeedoExtension) se.jdoExtension.get(i));
96         }
97     }
98
99 }
100
Popular Tags