1 /* 2 * Copyright 2006-2023 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 * https://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 Set<FullyQualifiedJavaType> getImportedTypes(); 30 31 Set<String> getStaticImports(); 32 33 FullyQualifiedJavaType getType(); 34 35 void addImportedType(FullyQualifiedJavaType importedType); 36 37 void addImportedTypes(Set<FullyQualifiedJavaType> importedTypes); 38 39 void addStaticImport(String staticImport); 40 41 void addStaticImports(Set<String> staticImports); 42 43 /** 44 * Comments will be written at the top of the file as is, we do not append any start or end comment characters. 45 * 46 * <p>Note that in the Eclipse plugin, file comments will not be merged. 47 * 48 * @param commentLine 49 * the comment line 50 */ 51 void addFileCommentLine(String commentLine); 52 53 List<String> getFileCommentLines(); 54 55 <R> R accept(CompilationUnitVisitor<R> visitor); 56 }