src/share/classes/com/sun/source/util/TaskEvent.java

Tue, 28 Dec 2010 15:54:52 -0800

author
ohair
date
Tue, 28 Dec 2010 15:54:52 -0800
changeset 798
4868a36f6fd8
parent 582
366a7b9b5627
child 1357
c75be5bc5283
permissions
-rw-r--r--

6962318: Update copyright year
Reviewed-by: xdono

     1 /*
     2  * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package com.sun.source.util;
    28 import com.sun.source.tree.CompilationUnitTree;
    29 import javax.lang.model.element.TypeElement;
    30 import javax.tools.JavaFileObject;
    32 /**
    33  * Provides details about work that has been done by the JDK Java Compiler, javac.
    34  *
    35  * @author Jonathan Gibbons
    36  * @since 1.6
    37  */
    38 public final class TaskEvent
    39 {
    40     /**
    41      * Kind of task event.
    42      * @since 1.6
    43      */
    44     public enum Kind {
    45         /**
    46          * For events related to the parsing of a file.
    47          */
    48         PARSE,
    49         /**
    50          * For events relating to elements being entered.
    51          **/
    52         ENTER,
    53         /**
    54          * For events relating to elements being analyzed for errors.
    55          **/
    56         ANALYZE,
    57         /**
    58          * For events relating to class files being generated.
    59          **/
    60         GENERATE,
    61         /**
    62          * For events relating to overall annotaion processing.
    63          **/
    64         ANNOTATION_PROCESSING,
    65         /**
    66          * For events relating to an individual annotation processing round.
    67          **/
    68         ANNOTATION_PROCESSING_ROUND
    69     };
    71     public TaskEvent(Kind kind) {
    72         this(kind, null, null, null);
    73     }
    75     public TaskEvent(Kind kind, JavaFileObject sourceFile) {
    76         this(kind, sourceFile, null, null);
    77     }
    79     public TaskEvent(Kind kind, CompilationUnitTree unit) {
    80         this(kind, unit.getSourceFile(), unit, null);
    81     }
    83     public TaskEvent(Kind kind, CompilationUnitTree unit, TypeElement clazz) {
    84         this(kind, unit.getSourceFile(), unit, clazz);
    85     }
    87     private TaskEvent(Kind kind, JavaFileObject file, CompilationUnitTree unit, TypeElement clazz) {
    88         this.kind = kind;
    89         this.file = file;
    90         this.unit = unit;
    91         this.clazz = clazz;
    92     }
    94     public Kind getKind() {
    95         return kind;
    96     }
    98     public JavaFileObject getSourceFile() {
    99         return file;
   100     }
   102     public CompilationUnitTree getCompilationUnit() {
   103         return unit;
   104     }
   106     public TypeElement getTypeElement() {
   107         return clazz;
   108     }
   110     public String toString() {
   111         return "TaskEvent["
   112             + kind + ","
   113             + file + ","
   114             // the compilation unit is identified by the file
   115             + clazz + "]";
   116     }
   118     private Kind kind;
   119     private JavaFileObject file;
   120     private CompilationUnitTree unit;
   121     private TypeElement clazz;
   122 }

mercurial