01: /*
02: * Copyright (c) 1998 - 2005 Versant Corporation
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Versant Corporation - initial API and implementation
10: */
11: package com.versant.core.metadata.parser;
12:
13: import com.versant.core.common.Debug;
14:
15: import java.io.PrintStream;
16:
17: /**
18: * Package element from a .jdo file.
19: */
20: public final class JdoPackage extends JdoElement {
21:
22: public String name;
23: public JdoClass[] classes;
24: public JdoExtension[] extensions;
25: public JdoRoot parent;
26:
27: public JdoElement getParent() {
28: return parent;
29: }
30:
31: /**
32: * Get information for this element to be used in building up a
33: * context string.
34: * @see #getContext
35: */
36: public String getSubContext() {
37: return "package[" + name + "]";
38: }
39:
40: public String toString() {
41: return getSubContext();
42: }
43:
44: public void dump() {
45: dump(Debug.OUT, "");
46: }
47:
48: public void dump(PrintStream out, String indent) {
49: out.println(indent + this );
50: String is = indent + " ";
51: if (classes != null) {
52: for (int i = 0; i < classes.length; i++) {
53: classes[i].dump(out, is);
54: }
55: }
56: if (extensions != null) {
57: for (int i = 0; i < extensions.length; i++) {
58: extensions[i].dump(out, is);
59: }
60: }
61: }
62:
63: }
|