1 /******************************************************************************* 2 * Copyright (c) 2005, 2007 BEA Systems, Inc. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * tyeung@bea.com - initial API 10 *******************************************************************************/ 11 package org.eclipse.jdt.apt.core.env; 12 13 import org.eclipse.jdt.apt.core.util.EclipseMessager; 14 import org.eclipse.jdt.core.IJavaProject; 15 import org.eclipse.jdt.core.dom.CompilationUnit; 16 17 import com.sun.mirror.apt.AnnotationProcessorEnvironment; 18 19 /** 20 * Extended the APT {@link AnnotationProcessorEnvironment} to expose 21 * extra API. 22 */ 23 public interface EclipseAnnotationProcessorEnvironment extends 24 AnnotationProcessorEnvironment 25 { 26 /** 27 * Return the AST of the file currently being processed. 28 * @return the root of the fully flushed out DOM/AST of the file that is currently being processed. 29 * This AST will contain binding information. 30 * Return <code>null</code> for if called by a batch processor. 31 */ 32 CompilationUnit getAST(); 33 34 /** 35 * @return a messager for registering diagnostics. 36 */ 37 EclipseMessager getMessager(); 38 39 /** 40 * @return the current processing phase: either 41 * {@link Phase#RECONCILE} or {@link Phase#BUILD} 42 * 43 */ 44 Phase getPhase(); 45 46 /** 47 * @return the java project associated with the current processing phase 48 */ 49 IJavaProject getJavaProject(); 50 51 /** 52 * Add a type dependency on the type named <code>fullyQualifiedTypeName</code> 53 * @param fullyQualifiedTypeName the fully qualified (dot-separated) name of a type. 54 * @throws IllegalArgumentException if <code>fullyQualifiedTypeName</code> cannot be resolved to a type. 55 */ 56 void addTypeDependency(final String fullyQualifiedTypeName); 57 } 58