KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > schema2beansdev > CodeGeneratorClass


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.schema2beansdev;
21
22 import java.io.*;
23 import java.util.*;
24
25 import org.netbeans.modules.schema2beans.*;
26 import org.netbeans.modules.schema2beansdev.metadd.*;
27
28 public interface CodeGeneratorClass {
29     /**
30      * This method is called by the BeanBuilder to register a new property
31      * on this bean class.
32      */

33     AbstractCodeGeneratorClass.Property addProperty(String JavaDoc name,
34                      String JavaDoc dtdName, String JavaDoc namespace,
35                      GraphNode node, GraphLink l, String JavaDoc classType, int nestedLevel,
36                      int eltInstance, int groupInstance,
37                      int type, boolean ored, AttrProp[] propAttributes,
38                      String JavaDoc constName, String JavaDoc defaultValue,
39                      boolean directChild, List extraData, boolean isUnion);
40     List/*<AbstractCodeGeneratorClass.Property>*/ getPropertyList();
41
42     void setPackageName(String JavaDoc n);
43
44     /**
45      * The string that is used for indentation.
46      */

47     void setIndent(String JavaDoc indent);
48
49     /**
50      * Generate the java code in the out stream, using the optional
51      * metaDD bean graph.
52      */

53     void generate(String JavaDoc filename, MetaDD mdd) throws IOException;
54
55     /**
56      * Generate the java code in the out stream, using the optional
57      * metaDD bean graph.
58      */

59     void generate(OutputStream out, MetaDD mdd) throws IOException;
60
61     public void generateDelegator(OutputStream out, MetaDD mdd,
62                                   String JavaDoc delegatorClassName,
63                                   String JavaDoc delegatorPackageName) throws IOException;
64
65     /**
66      * The generator should put in an entry for every name that is
67      * invalid to use as a property name.
68      *
69      * @param invalidNames is a
70      * Map<String, BeanElement> where they key is the invalid name and
71      * the value (BeanElement) is most likely null.
72      * For instance, anything that inherits from java.lang.Object will
73      * not be able to generate a getClass method, so the property
74      * named "Class" is invalid.
75      * Typically, the invalid method names are due to a parent class
76      * already having a method of that name with the same parameters
77      * (overloading is okay though). A property X is invalid if a
78      * parent class already has a getX(); and if X might
79      * ever be an array, then also getX(int) or sizeX().
80      */

81     public void setInvalidPropertyNames(Map invalidNames);
82     
83     public void setRootBeanElement(BeanBuilder.BeanElement element);
84
85     /**
86      * Set the namespace that will be used by default in the documents.
87      */

88     public void setDefaultNamespace(String JavaDoc ns);
89
90     public Collection getGeneratedMethods(); // Collection<JavaWriter.Method>
91

92     /**
93      * Print out the bean graph.
94      */

95     public void dumpBeanTree(java.io.Writer JavaDoc out, String JavaDoc indent, String JavaDoc indentBy) throws java.io.IOException JavaDoc;
96     
97     public void setPrefixGuesser(PrefixGuesser guesser);
98 }
99
Popular Tags