org.fife.rsta.ac.java
Class JarInfo

java.lang.Object
  extended by org.fife.rsta.ac.java.JarInfo
All Implemented Interfaces:
Cloneable, Comparable

public class JarInfo
extends Object
implements Comparable, Cloneable

Information about a jar to add to the "build path" for Java completion. This includes both the jar itself, as well as its source location (e.g. a zip file, jar file or directory).

Version:
1.0
Author:
Robert Futrell

Constructor Summary
JarInfo(File jarFile)
          Constructor.
 
Method Summary
 Object clone()
          
 int compareTo(Object o)
          
 boolean equals(Object obj)
          Returns whether this instance points to the same jar as another instance of JarInfo.
 File getJarFile()
          Gets the jar file.
static JarInfo getJREJarInfo(File jreHome)
          Returns information on the "main" jar for a JRE.
static JarInfo getMainJREJarInfo()
          Returns information on the JRE running this application.
 File getSourceLocation()
          Returns the source location for the jar file.
 int hashCode()
          
 void setJarFile(File jarFile)
          Sets the jar file location.
 void setSourceLocation(File loc)
          Sets the location of the source for this jar file's classes.
 String toString()
          Returns a string representation of this jar information.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JarInfo

public JarInfo(File jarFile)
Constructor.

Parameters:
jarFile - The jar file. This cannot be null.
Method Detail

clone

public Object clone()

Overrides:
clone in class Object

compareTo

public int compareTo(Object o)

Specified by:
compareTo in interface Comparable

equals

public boolean equals(Object obj)
Returns whether this instance points to the same jar as another instance of JarInfo. The source location is not taken into account for this comparison.

Overrides:
equals in class Object
Parameters:
obj - Another JarInfo.
Returns:
Whether these two instances point to the same jar file.

getJarFile

public File getJarFile()
Gets the jar file.

Returns:
The jar file.
See Also:
setJarFile(File)

getJREJarInfo

public static JarInfo getJREJarInfo(File jreHome)
Returns information on the "main" jar for a JRE. This will be rt.jar everywhere except OS X, where it will be classes.jar. The associated source zip/jar file is also checked for.

Returns:
The information, or null if there is not a JRE in the specified directory.
See Also:
getMainJREJarInfo()

getMainJREJarInfo

public static JarInfo getMainJREJarInfo()
Returns information on the JRE running this application. This will be rt.jar everywhere except OS X, where it will be classes.jar. The associated source zip/jar file is also checked for.

Returns:
The information, or null if an error occurs.
See Also:
getJREJarInfo(File)

getSourceLocation

public File getSourceLocation()
Returns the source location for the jar file.

Returns:
The source location (an archive or directory), or null if there is no attached source location.
See Also:
setSourceLocation(File)

hashCode

public int hashCode()

Overrides:
hashCode in class Object

setJarFile

public void setJarFile(File jarFile)
Sets the jar file location.

Parameters:
jarFile - The jar file location. This cannot be null.
See Also:
getJarFile()

setSourceLocation

public void setSourceLocation(File loc)
Sets the location of the source for this jar file's classes.

Parameters:
loc - The source location. This should be a zip file, a jar file, or a directory. This value may be null.
See Also:
getSourceLocation()

toString

public String toString()
Returns a string representation of this jar information. Useful for debugging.

Overrides:
toString in class Object
Returns:
A string representation of this object.


Copyright © 2003-2011. All Rights Reserved.