1 /**
2 * Copyright 2006-2016 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.mybatis.generator.api.dom.java;
17
18 import java.util.List;
19 import java.util.Set;
20
21 /**
22 * This interface describes methods common to all Java compilation units (Java
23 * classes, interfaces, and enums).
24 *
25 * @author Jeff Butler
26 */
27 public interface CompilationUnit {
28
29 /**
30 * Gets the formatted content.
31 *
32 * @return the formatted content
33 */
34 String getFormattedContent();
35
36 /**
37 * Gets the imported types.
38 *
39 * @return the imported types
40 */
41 Set<FullyQualifiedJavaType> getImportedTypes();
42
43 /**
44 * Gets the static imports.
45 *
46 * @return the static imports
47 */
48 Set<String> getStaticImports();
49
50 /**
51 * Gets the super class.
52 *
53 * @return the super class
54 */
55 FullyQualifiedJavaType getSuperClass();
56
57 /**
58 * Checks if is java interface.
59 *
60 * @return true, if is java interface
61 */
62 boolean isJavaInterface();
63
64 /**
65 * Checks if is java enumeration.
66 *
67 * @return true, if is java enumeration
68 */
69 boolean isJavaEnumeration();
70
71 /**
72 * Gets the super interface types.
73 *
74 * @return the super interface types
75 */
76 Set<FullyQualifiedJavaType> getSuperInterfaceTypes();
77
78 /**
79 * Gets the type.
80 *
81 * @return the type
82 */
83 FullyQualifiedJavaType getType();
84
85 /**
86 * Adds the imported type.
87 *
88 * @param importedType
89 * the imported type
90 */
91 void addImportedType(FullyQualifiedJavaType importedType);
92
93 /**
94 * Adds the imported types.
95 *
96 * @param importedTypes
97 * the imported types
98 */
99 void addImportedTypes(Set<FullyQualifiedJavaType> importedTypes);
100
101 /**
102 * Adds the static import.
103 *
104 * @param staticImport
105 * the static import
106 */
107 void addStaticImport(String staticImport);
108
109 /**
110 * Adds the static imports.
111 *
112 * @param staticImports
113 * the static imports
114 */
115 void addStaticImports(Set<String> staticImports);
116
117 /**
118 * Comments will be written at the top of the file as is, we do not append any start or end comment characters.
119 *
120 * Note that in the Eclipse plugin, file comments will not be merged.
121 *
122 * @param commentLine
123 * the comment line
124 */
125 void addFileCommentLine(String commentLine);
126
127 /**
128 * Gets the file comment lines.
129 *
130 * @return the file comment lines
131 */
132 List<String> getFileCommentLines();
133 }