01: /*
02: * Copyright 2006 Google Inc.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
05: * use this file except in compliance with the License. You may obtain a copy of
06: * the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13: * License for the specific language governing permissions and limitations under
14: * the License.
15: */
16: package com.google.gwt.dev.jdt;
17:
18: import com.google.gwt.core.ext.TreeLogger;
19: import com.google.gwt.core.ext.UnableToCompleteException;
20: import com.google.gwt.core.ext.typeinfo.CompilationUnitProvider;
21:
22: /**
23: * Abstracts the process of determining which source file contains a given Java
24: * type and specifying whether or not a given name is a package.
25: */
26: public interface SourceOracle {
27:
28: /**
29: * Attempts to find a compilation unit for the specified source type name.
30: *
31: * @return <code>null</code> if a compilation unit for the specified type
32: * was not found or an error prevented the compilation unit from being
33: * provided
34: */
35: CompilationUnitProvider findCompilationUnit(TreeLogger logger,
36: String sourceTypeName) throws UnableToCompleteException;
37:
38: /**
39: * Determines whether or not a string is the name of a package. Remember that
40: * every part of a package name is also a package. For example, the fact that
41: * <code>java.lang</code> is a package implies that <code>java</code> is
42: * also a package.
43: */
44: boolean isPackage(String possiblePackageName);
45: }
|