View Javadoc

1   package org.springframework.roo.classpath.javaparser;
2   
3   import japa.parser.ast.ImportDeclaration;
4   import japa.parser.ast.body.TypeDeclaration;
5   import japa.parser.ast.expr.Expression;
6   
7   import java.util.List;
8   
9   import org.springframework.roo.model.JavaPackage;
10  import org.springframework.roo.model.JavaType;
11  
12  /**
13   * An interface that enables Java Parser types to request the compilation unit to be written to disk,
14   * as well as find out relevant information about a compilation unit.
15   *
16   * <p>
17   * This is generally useful if a Java Parser type internally stores an {@link Expression} or similar and
18   * may support modifying its on-disk representation.
19   * 
20   * @author Ben Alex
21   * @since 1.0
22   *
23   */
24  public interface CompilationUnitServices {
25  
26  	List<ImportDeclaration> getImports();
27  
28  	JavaPackage getCompilationUnitPackage();
29  
30  	/**
31  	 * @return the enclosing type (never null)
32  	 */
33  	JavaType getEnclosingTypeName();
34  	
35  	/**
36  	 * @return the names of each inner type and the enclosing type (never null but may be empty)
37  	 */
38  	List<TypeDeclaration> getInnerTypes();
39  	
40  	/**
41  	 * Forces the implementation to flush any changes.
42  	 */
43  	void flush();
44  }