org.osjava.jardiff
Class JarDiff

java.lang.Object
  extended byorg.osjava.jardiff.JarDiff

public class JarDiff
extends Object

A class to perform a diff between two jar files.

Author:
Antony Riley

Field Summary
protected  Map depClassInfo
          A map containing information about classes which are dependencies.
protected  Map newClassInfo
          A map containing information about classes in the new jar file.
protected  Map oldClassInfo
          A map containing information about classes in the old jar file.
 
Constructor Summary
JarDiff()
          Create a new JarDiff object.
 
Method Summary
 void diff(DiffHandler handler, DiffCriteria criteria)
          Perform a diff sending the output to the specified handler, using the specified criteria to select diffs.
 URL[] getDependencies()
          Get the dependencies.
 String getNewVersion()
          Get the name of the new version.
 String getOldVersion()
          Get the name of the old version.
 void loadNewClasses(File file)
          Load new classes from the specified File.
 void loadNewClasses(URL loc)
          Load new classes from the specified URL.
 void loadOldClasses(File file)
          Load old classes from the specified File.
 void loadOldClasses(URL loc)
          Load old classes from the specified URL.
 void setDependencies(URL[] deps)
          Set the dependencies.
 void setNewVersion(String newVersion)
          Set the name of the new version.
 void setOldVersion(String oldVersion)
          Set the name of the old version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

depClassInfo

protected Map depClassInfo
A map containing information about classes which are dependencies. Keys are internal class names. Values are instances of ClassInfo.


oldClassInfo

protected Map oldClassInfo
A map containing information about classes in the old jar file. Keys are internal class names. Values are instances of ClassInfo.


newClassInfo

protected Map newClassInfo
A map containing information about classes in the new jar file. Keys are internal class names. Values are instances of ClassInfo.

Constructor Detail

JarDiff

public JarDiff()
Create a new JarDiff object.

Method Detail

setOldVersion

public void setOldVersion(String oldVersion)
Set the name of the old version.

Parameters:
oldVersion - the name

getOldVersion

public String getOldVersion()
Get the name of the old version.

Returns:
the name

setNewVersion

public void setNewVersion(String newVersion)
Set the name of the new version.

Parameters:
newVersion -

getNewVersion

public String getNewVersion()
Get the name of the new version.

Returns:
the name

setDependencies

public void setDependencies(URL[] deps)
Set the dependencies.

Parameters:
deps - an array of urls pointing to jar files or directories containing classes which are required dependencies.

getDependencies

public URL[] getDependencies()
Get the dependencies.

Returns:
the dependencies as an array of URLs

loadOldClasses

public void loadOldClasses(URL loc)
                    throws DiffException
Load old classes from the specified URL.

Parameters:
loc - The location of a jar file to load classes from.
Throws:
DiffException - if there is an IOException.

loadNewClasses

public void loadNewClasses(URL loc)
                    throws DiffException
Load new classes from the specified URL.

Parameters:
loc - The location of a jar file to load classes from.
Throws:
DiffException - if there is an IOException.

loadOldClasses

public void loadOldClasses(File file)
                    throws DiffException
Load old classes from the specified File.

Parameters:
file - The location of a jar file to load classes from.
Throws:
DiffException - if there is an IOException

loadNewClasses

public void loadNewClasses(File file)
                    throws DiffException
Load new classes from the specified File.

Parameters:
file - The location of a jar file to load classes from.
Throws:
DiffExeption - if there is an IOException
DiffException

diff

public void diff(DiffHandler handler,
                 DiffCriteria criteria)
          throws DiffException
Perform a diff sending the output to the specified handler, using the specified criteria to select diffs.

Parameters:
handler - The handler to receive and handle differences.
criteria - The criteria we use to select differences.
Throws:
DiffException - when there is an underlying exception, e.g. writing to a file caused an IOException


Copyright © 2005-2006 OSJava. All Rights Reserved.