01: /*
02: * Copyright 2005 Joe Walker
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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: package org.directwebremoting.drapgen.generate.gi;
17:
18: import java.io.IOException;
19: import java.util.Collection;
20: import java.util.HashMap;
21: import java.util.Map;
22:
23: /**
24: * @author Joe Walker [joe at getahead dot ltd dot uk]
25: */
26: public class GiProject {
27: protected final Map<String, GiType> sources = new HashMap<String, GiType>();
28:
29: /**
30: * @param code
31: */
32: public void add(GiType code) {
33: sources.put(code.getClassName(), code);
34: }
35:
36: /**
37: *
38: */
39: public Collection<GiType> getClasses() {
40: return sources.values();
41: }
42:
43: /**
44: *
45: */
46: public GiType getClassByName(String name) {
47: return sources.get(name);
48: }
49:
50: /**
51: * @param directory Where to write the XML
52: *
53: */
54: public void save(String directory) throws IOException {
55: for (GiType code : sources.values()) {
56: code.writeDOM(directory);
57: }
58: }
59: }
|