KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > edu > umd > cs > findbugs > classfile > IAnalysisCache


1 /*
2  * FindBugs - Find Bugs in Java programs
3  * Copyright (C) 2006, University of Maryland
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19
20 package edu.umd.cs.findbugs.classfile;
21
22
23 /**
24  * The analysis cache performs analyses on classes and methods
25  * and caches the results.
26  *
27  * @author David Hovemeyer
28  */

29 public interface IAnalysisCache {
30     /**
31      * Register the given class analysis engine as producing the
32      * analysis result type whose Class is given.
33      *
34      * @param <E> analysis result type
35      * @param analysisResultType analysis result type Class object
36      * @param classAnalysisEngine the class analysis engine to register
37      */

38     public<E> void registerClassAnalysisEngine(
39             Class JavaDoc<E> analysisResultType, IClassAnalysisEngine classAnalysisEngine);
40
41     /**
42      * Register the given method analysis engine as producing the
43      * analysis result type whose Class is given.
44      *
45      * @param <E> analysis result type
46      * @param analysisResultType analysis result type Class object
47      * @param methodAnalysisEngine the method analysis engine to register
48      */

49     public<E> void registerMethodAnalysisEngine(
50             Class JavaDoc<E> analysisResultType, IMethodAnalysisEngine methodAnalysisEngine);
51
52     /**
53      * Get an analysis of the given class.
54      *
55      * @param <E> the type of the analysis (e.g., FoobarAnalysis)
56      * @param analysisClass the analysis class object (e.g., FoobarAnalysis.class)
57      * @param classDescriptor the descriptor of the class to analyze
58      * @return the analysis object (e.g., instance of FoobarAnalysis for the class)
59      * @throws CheckedAnalysisException if an error occurs performing the analysis
60      */

61     public<E> E getClassAnalysis(Class JavaDoc<E> analysisClass, ClassDescriptor classDescriptor)
62         throws CheckedAnalysisException;
63
64     /**
65      * See if the cache contains a cached class analysis result
66      * for given class descriptor.
67      *
68      * @param analysisClass analysis result class
69      * @param classDescriptor the class descriptor
70      * @return a cached analysis result, or null if there is no cached analysis result
71      */

72     public<E> E probeClassAnalysis(Class JavaDoc<E> analysisClass, ClassDescriptor classDescriptor);
73
74     /**
75      * Get an analysis of the given method.
76      *
77      * @param <E> the type of the analysis (e.g., FoobarAnalysis)
78      * @param analysisClass the analysis class object (e.g., FoobarAnalysis.class)
79      * @param methodDescriptor the descriptor of the method to analyze
80      * @return the analysis object (e.g., instance of FoobarAnalysis for the method)
81      * @throws CheckedAnalysisException if an error occurs performing the analysis
82      */

83     public<E> E getMethodAnalysis(Class JavaDoc<E> analysisClass, MethodDescriptor methodDescriptor)
84         throws CheckedAnalysisException;
85
86     /**
87      * Register a database factory.
88      *
89      * @param <E> type of database
90      * @param databaseClass Class of database
91      * @param databaseFactory the database factory
92      */

93     public<E> void registerDatabaseFactory(Class JavaDoc<E> databaseClass, IDatabaseFactory<E> databaseFactory);
94     
95     /**
96      * Get a database.
97      *
98      * @param <E> type of database
99      * @param databaseClass Class of database
100      * @return the database (which is created by a database factory if required)
101      * @throws CheckedAnalysisException
102      */

103     public<E> E getDatabase(Class JavaDoc<E> databaseClass) throws CheckedAnalysisException;
104     
105     /**
106      * Get the classpath from which classes are loaded.
107      *
108      * @return the classpath
109      */

110     public IClassPath getClassPath();
111     
112     /**
113      * Get the error logger.
114      *
115      * @return the error logger
116      */

117     public IErrorLogger getErrorLogger();
118 }
119
Popular Tags