View Javadoc
1   package net.sourceforge.jenesis4java;
2   
3   /*
4    * #%L
5    * Jenesis 4 Java Code Generator
6    * %%
7    * Copyright (C) 2000 - 2015 jenesis4java
8    * %%
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU Lesser General Public License as
11   * published by the Free Software Foundation, either version 3 of the
12   * License, or (at your option) any later version.
13   * 
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Lesser Public License for more details.
18   * 
19   * You should have received a copy of the GNU General Lesser Public
20   * License along with this program.  If not, see
21   * <http://www.gnu.org/licenses/lgpl-3.0.html>.
22   * #L%
23   */
24  
25  import java.util.List;
26  
27  /**
28   * Copyright (C) 2008, 2010 Richard van Nieuwenhoven - ritchie [at] gmx [dot] at
29   * Copyright (C) 2000, 2001 Paul Cody Johnston - pcj@inxar.org <br>
30   * This file is part of Jenesis4java. Jenesis4java is free software: you can
31   * redistribute it and/or modify it under the terms of the GNU Lesser General
32   * Public License as published by the Free Software Foundation, either version 3
33   * of the License, or (at your option) any later version.<br>
34   * Jenesis4java is distributed in the hope that it will be useful, but WITHOUT
35   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
36   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
37   * details.<br>
38   * You should have received a copy of the GNU Lesser General Public License
39   * along with Jenesis4java. If not, see <http://www.gnu.org/licenses/>.
40   */
41  /**
42   * {@code Declaration} subinterface for the class declaration heirarchy.
43   */
44  public interface ClassDeclaration extends TypeDeclaration {
45  
46      /**
47       * Adds the given string to the list of implements clauses.
48       */
49      ClassDeclaration addImplements(String type);
50  
51      /**
52       * Adds the given import declaration to the compilation unit.
53       */
54      Import addImport(Class<?> clazz);
55  
56      /**
57       * Adds the given import declaration to the compilation unit.
58       */
59      Import addImport(String name);
60  
61      /**
62       * Gets the list of constructors as an list of {@code Constructor}.
63       */
64      List<Constructor> getConstructors();
65  
66      /**
67       * Gets the extends clause.
68       */
69      String getExtends();
70  
71      /**
72       * Gets the list of fields as an list of {@code ClassField}.
73       */
74      List<ClassField> getFields();
75  
76      /**
77       * Gets the list of implementation clauses as an list of {@code String} .
78       */
79      List<String> getImplements();
80  
81      /**
82       * removes the interface of the list of implementation clauses and returns
83       * if the interface was present. .
84       */
85      boolean removeImplements(String interfaceName);
86  
87      /**
88       * Gets the list of inner classes as an list of {@code InnerClass}.
89       */
90      List<InnerClass> getInnerClasses();
91  
92      /**
93       * Gets the list of method as an list of {@code ClassMethod}.
94       */
95      List<ClassMethod> getMethods();
96  
97      /**
98       * Returns a list containing all {@code ClassMethod}s of the underlying
99       * {@code ClassDeclaration} with the specified name.
100      * 
101      * @param methodName
102      * @return all {@code ClassMethod}s with the specified name.
103      */
104     List<ClassMethod> getMethods(String methodName);
105 
106     /**
107      * Gets the list of static initializers as an list of
108      * {@code StaticInitializer}.
109      */
110     List<StaticInitializer> getStaticInitializers();
111 
112     /**
113      * Getter method for the isAbstract flag.
114      */
115     boolean isAbstract();
116 
117     /**
118      * Setter method for the isAbstract flag.
119      */
120     ClassDeclaration isAbstract(boolean value);
121 
122     /**
123      * Creates a new static initialization block in this class
124      */
125 
126     boolean isMethodAlreadyDefined(Type type, String name);
127 
128     /**
129      * Creates a new constructor in this class
130      */
131     Constructor newConstructor();
132 
133     /**
134      * Creates a new field in this class with the given type and name.
135      */
136     ClassField newField(Class<?> type, String name);
137 
138     /**
139      * Creates a new field in this class with the given type and name.
140      */
141     ClassField newField(Type type, String name);
142 
143     /**
144      * Creates a new inner class in this class.
145      */
146     InnerClass newInnerClass(String name);
147 
148     /**
149      * Creates a new inner class in this class.
150      */
151     InnerInterface newInnerInterface(String name);
152 
153     /**
154      * Creates a new void method in this class with the given type and name.
155      */
156     ClassMethod newMethod(String name);
157 
158     /**
159      * Creates a new method in this class with the given type and name.
160      */
161     ClassMethod newMethod(Type type, String name);
162 
163     StaticInitializer newStaticInitializer();
164 
165     /**
166      * Sets the extends clause to the given string. A class can extend only one
167      * type.
168      */
169     ClassDeclaration setExtends(String type);
170 }