01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.internal.compiler.lookup;
11:
12: import org.eclipse.jdt.core.compiler.CharOperation;
13: import org.eclipse.jdt.internal.compiler.ast.ImportReference;
14:
15: public class ImportBinding extends Binding {
16: public char[][] compoundName;
17: public boolean onDemand;
18: public ImportReference reference;
19:
20: public Binding resolvedImport; // must ensure the import is resolved
21:
22: public ImportBinding(char[][] compoundName, boolean isOnDemand,
23: Binding binding, ImportReference reference) {
24: this .compoundName = compoundName;
25: this .onDemand = isOnDemand;
26: this .resolvedImport = binding;
27: this .reference = reference;
28: }
29:
30: /* API
31: * Answer the receiver's binding type from Binding.BindingID.
32: */
33:
34: public final int kind() {
35: return IMPORT;
36: }
37:
38: public boolean isStatic() {
39: return this .reference != null && this .reference.isStatic();
40: }
41:
42: public char[] readableName() {
43: if (onDemand)
44: return CharOperation.concat(CharOperation.concatWith(
45: compoundName, '.'), ".*".toCharArray()); //$NON-NLS-1$
46: else
47: return CharOperation.concatWith(compoundName, '.');
48: }
49:
50: public String toString() {
51: return "import : " + new String(readableName()); //$NON-NLS-1$
52: }
53: }
|