public class JarDiff
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.Map |
depClassInfo
A map containing information about classes which are dependencies.
|
private java.net.URLClassLoader |
depLoader
A class loader used for loading dependency classes.
|
private java.net.URL[] |
deps
An array of dependencies which are jar files, or urls.
|
private ClassInfoVisitor |
infoVisitor
Class info visitor, used to load information about classes.
|
protected java.util.Map |
newClassInfo
A map containing information about classes in the new jar file.
|
private java.lang.String |
newVersion
The name of the new version.
|
protected java.util.Map |
oldClassInfo
A map containing information about classes in the old jar file.
|
private java.lang.String |
oldVersion
The name of the old version.
|
Constructor and Description |
---|
JarDiff()
Create a new JarDiff object.
|
Modifier and Type | Method and Description |
---|---|
void |
diff(DiffHandler handler,
DiffCriteria criteria)
Perform a diff sending the output to the specified handler, using
the specified criteria to select diffs.
|
java.net.URL[] |
getDependencies()
Get the dependencies.
|
java.lang.String |
getNewVersion()
Get the name of the new version.
|
java.lang.String |
getOldVersion()
Get the name of the old version.
|
private void |
loadClasses(java.util.Map infoMap,
java.io.File file)
Load all the classes from the specified URL and store information
about them in the specified map.
|
private void |
loadClasses(java.util.Map infoMap,
java.net.URL path)
Load all the classes from the specified URL and store information
about them in the specified map.
|
private ClassInfo |
loadClassInfo(org.objectweb.asm.ClassReader reader)
Load classinfo given a ClassReader.
|
void |
loadNewClasses(java.io.File file)
Load new classes from the specified File.
|
void |
loadNewClasses(java.net.URL loc)
Load new classes from the specified URL.
|
void |
loadOldClasses(java.io.File file)
Load old classes from the specified File.
|
void |
loadOldClasses(java.net.URL loc)
Load old classes from the specified URL.
|
void |
setDependencies(java.net.URL[] deps)
Set the dependencies.
|
void |
setNewVersion(java.lang.String newVersion)
Set the name of the new version.
|
void |
setOldVersion(java.lang.String oldVersion)
Set the name of the old version.
|
protected java.util.Map depClassInfo
protected java.util.Map oldClassInfo
protected java.util.Map newClassInfo
private java.net.URL[] deps
private java.net.URLClassLoader depLoader
private java.lang.String oldVersion
private java.lang.String newVersion
private ClassInfoVisitor infoVisitor
public void setOldVersion(java.lang.String oldVersion)
oldVersion
- the namepublic java.lang.String getOldVersion()
public void setNewVersion(java.lang.String newVersion)
newVersion
- public java.lang.String getNewVersion()
public void setDependencies(java.net.URL[] deps)
deps
- an array of urls pointing to jar files or directories
containing classes which are required dependencies.public java.net.URL[] getDependencies()
private ClassInfo loadClassInfo(org.objectweb.asm.ClassReader reader) throws java.io.IOException
reader
- the ClassReaderjava.io.IOException
private void loadClasses(java.util.Map infoMap, java.net.URL path) throws DiffException
infoMap
- the map to store the ClassInfo in.DiffException
- if there is an exception reading info about a
class.private void loadClasses(java.util.Map infoMap, java.io.File file) throws DiffException
infoMap
- the map to store the ClassInfo in.file
- the jarfile to load classes from.java.io.IOException
- if there is an IOException reading info about a
class.DiffException
public void loadOldClasses(java.net.URL loc) throws DiffException
loc
- The location of a jar file to load classes from.DiffException
- if there is an IOException.public void loadNewClasses(java.net.URL loc) throws DiffException
loc
- The location of a jar file to load classes from.DiffException
- if there is an IOException.public void loadOldClasses(java.io.File file) throws DiffException
file
- The location of a jar file to load classes from.DiffException
- if there is an IOExceptionpublic void loadNewClasses(java.io.File file) throws DiffException
file
- The location of a jar file to load classes from.DiffExeption
- if there is an IOExceptionDiffException
public void diff(DiffHandler handler, DiffCriteria criteria) throws DiffException
handler
- The handler to receive and handle differences.criteria
- The criteria we use to select differences.DiffException
- when there is an underlying exception, e.g.
writing to a file caused an IOException