added -J option to preserve unmodified files in preexisting jarfile
[org.ibex.tool.git] / src / org / eclipse / jdt / internal / compiler / lookup / ImportBinding.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package org.eclipse.jdt.internal.compiler.lookup;
12
13 import org.eclipse.jdt.core.compiler.CharOperation;
14 import org.eclipse.jdt.internal.compiler.ast.ImportReference;
15
16 public class ImportBinding extends Binding {
17         public char[][] compoundName;
18         public boolean onDemand;
19         public ImportReference reference;
20
21         public Binding resolvedImport; // must ensure the import is resolved
22         
23 public ImportBinding(char[][] compoundName, boolean isOnDemand, Binding binding, ImportReference reference) {
24         this.compoundName = compoundName;
25         this.onDemand = isOnDemand;
26         this.resolvedImport = binding;
27         this.reference = reference;
28 }
29 /* API
30 * Answer the receiver's binding type from Binding.BindingID.
31 */
32
33 public final int kind() {
34         return IMPORT;
35 }
36 public boolean isStatic() {
37         return this.reference != null && this.reference.isStatic();
38 }
39 public char[] readableName() {
40         if (onDemand)
41                 return CharOperation.concat(CharOperation.concatWith(compoundName, '.'), ".*".toCharArray()); //$NON-NLS-1$
42         else
43                 return CharOperation.concatWith(compoundName, '.');
44 }
45 public String toString() {
46         return "import : " + new String(readableName()); //$NON-NLS-1$
47 }
48 }