Skip to main content
summaryrefslogtreecommitdiffstats
blob: 393537b2168726959e63f11ea5ce086b7a12a7b9 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/*******************************************************************************
 * Copyright (c) 2015, 2016 Google, Inc and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *   Stefan Xenos (Google) - Initial implementation
 *******************************************************************************/
package org.eclipse.jdt.internal.core.nd.java.model;

import org.eclipse.jdt.internal.compiler.env.IDependent;
import org.eclipse.jdt.internal.core.nd.util.CharArrayUtils;

/**
 * Holds a lightweight identifier for an IBinaryType, with sufficient information to either read it from
 * disk or read it from the index.
 */
public final class BinaryTypeDescriptor {
	public final char[] indexPath;
	public final char[] fieldDescriptor;
	public final char[] location;
	public final char[] workspacePath;

	/**
	 * Constructs a new descriptor
	 * 
	 * @param location
	 *            location where the archive (.jar or .class) can be found in the local filesystem
	 * @param fieldDescriptor
	 *            field descriptor for the type (see the JVM specification)
	 * @param workspacePath
	 *            location where the archive (.jar or class) can be found in the workspace. If it is not in the
	 *            workspace, this is the path where it can be found on the local filesystem.
	 * @param indexPath
	 *            index path for the new type (workspace-or-local path to jar optionally followed by a | and a relative
	 *            path within the .jar)
	 */
	public BinaryTypeDescriptor(char[] location, char[] fieldDescriptor, char[] workspacePath, char[] indexPath) {
		super();
		this.location = location;
		this.fieldDescriptor = fieldDescriptor;
		this.indexPath = indexPath;
		this.workspacePath = workspacePath;
	}

	public boolean isInJarFile() {
		return CharArrayUtils.indexOf(IDependent.JAR_FILE_ENTRY_SEPARATOR, this.indexPath) != -1;
	}
}

Back to the top