1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package org.eclipse.jdt.internal.compiler.env;
13 public class NameEnvironmentAnswer {
15 // only one of the three can be set
16 IBinaryType binaryType;
17 ICompilationUnit compilationUnit;
18 ISourceType[] sourceTypes;
20 public NameEnvironmentAnswer(IBinaryType binaryType) {
21 this.binaryType = binaryType;
24 public NameEnvironmentAnswer(ICompilationUnit compilationUnit) {
25 this.compilationUnit = compilationUnit;
28 public NameEnvironmentAnswer(ISourceType[] sourceTypes) {
29 this.sourceTypes = sourceTypes;
33 * Answer the resolved binary form for the type or null if the
34 * receiver represents a compilation unit or source type.
36 public IBinaryType getBinaryType() {
37 return this.binaryType;
41 * Answer the compilation unit or null if the
42 * receiver represents a binary or source type.
44 public ICompilationUnit getCompilationUnit() {
45 return this.compilationUnit;
49 * Answer the unresolved source forms for the type or null if the
50 * receiver represents a compilation unit or binary type.
52 * Multiple source forms can be answered in case the originating compilation unit did contain
53 * several type at once. Then the first type is guaranteed to be the requested type.
55 public ISourceType[] getSourceTypes() {
56 return this.sourceTypes;
60 * Answer whether the receiver contains the resolved binary form of the type.
62 public boolean isBinaryType() {
63 return this.binaryType != null;
67 * Answer whether the receiver contains the compilation unit which defines the type.
69 public boolean isCompilationUnit() {
70 return this.compilationUnit != null;
74 * Answer whether the receiver contains the unresolved source form of the type.
76 public boolean isSourceType() {
77 return this.sourceTypes != null;