public class JarDependencies
extends java.lang.Object
JarDependencies depend = new JarDependencies(myJarFile);It is then possible to use it in the application. One simple thing to do is checking if the JarDependencies has dependencies from another one. For example:
JarDependencies depend = new JarDependencies(myJarFile); JarDependencies anotherDepend = new JarDependencies(aSecondJarFile); boolean isDependingOn = depend.isDependingOn(anotherDepend);
Constructor and Description |
---|
JarDependencies()
Create an initially empty JarDependencies.
|
JarDependencies(java.io.File file)
Create a JarDependencies for a specified jar file or class files directory.
|
JarDependencies(java.io.File dir,
java.lang.String rootname,
boolean acceptUnversioned)
Create a JarDependencies for a specified jar file or class files directory.
|
JarDependencies(java.io.File dir,
java.lang.String rootname,
boolean acceptUnversioned,
short separatorType)
Create a JarDependencies for a specified jar file or class files directory.
|
Modifier and Type | Method and Description |
---|---|
boolean |
containsPath(java.lang.String path)
Return true if this jar file or class files directory contains the specified path.
|
ClassDependencies |
dependenciesFrom(JarDependencies dependencies)
Return the dependencies from this JarDependencies on another JarDependencies.
|
ClassDependencies |
dependenciesFrom(JarDependencies dependencies,
java.lang.String packagePath)
Return the dependencies from this JarDependencies on another JarDependencies.
|
ClassDependencies |
dependenciesFrom(JarDependencies dependencies,
java.lang.String packagePath,
boolean isStrict)
Return the dependencies from this JarDependencies on another JarDependencies.
|
java.util.Map<java.lang.String,java.lang.Integer> |
getClassesAccess()
Return the accessors for each class.
|
java.util.Map<java.lang.String,java.util.Set<java.lang.String>> |
getDependencies()
Return all the dependencies for all classes defined in this jar file or class files directory.
|
java.util.Map<java.lang.String,ClassDependencies> |
getDependencies(JarDependencies jarDepend)
Return the dependencies of this JarDependencies from another JarDependencies.
|
java.util.Map<java.lang.String,ClassDependencies> |
getDependencies(java.util.List<JarDependencies> jarList)
Return the dependencies of this JarDependencies from a list of JarDependencies.
|
ClassDependencies |
getDependenciesOn(java.lang.String pack,
boolean isStrict)
Return the internal dependencies in the JarDependencies on a specified package.
|
java.io.File |
getFile()
Return the jar file or class files directory.
|
java.util.jar.Manifest |
getManifest()
Return the Manifest if this represents a Jar file.
|
java.lang.String |
getName()
Return the name of the jar file or class files directory.
|
java.util.Set<java.lang.String> |
getPackageNames()
Return all the packages found in this jar file or class files directory.
|
java.util.Set<java.lang.String> |
getPaths()
Return all the paths found in this jar file or class files directory.
|
boolean |
hasDefaultPackage()
Return true if there are classes in the default package.
|
boolean |
isDependingOn(JarDependencies dependencies)
Return true if this jar file or class files directory depends on another jar file or class files directory.
|
boolean |
isDependingOn(JarDependencies dependencies,
java.lang.String packagePath)
Return true if this jar file or class files directory depends on another jar file or class files directory.
|
boolean |
isDependingOn(JarDependencies dependencies,
java.lang.String packagePath,
boolean isStrict)
Return true if this jar file or class files directory depends on another jar file or class files directory.
|
boolean |
isDependingOn(java.util.Set<java.lang.String> packages)
Return true if this JarDependencies depend on a list of packages or classes.
|
boolean |
isDependingOn(java.lang.String pack)
Return true if this JarDependencies depend on one package.
|
boolean |
isJarFile()
Return true if this represents a Jar file.
|
void |
setFile(java.io.File file)
Set the jar file or class files directory.
|
void |
setFile(java.io.File dir,
java.lang.String rootname,
boolean acceptUnversioned)
Set the jar file directory using a file name pattern, using the fdash the separate the pattern elements.
|
void |
setFile(java.io.File dir,
java.lang.String rootname,
boolean acceptUnversioned,
short separatorType)
Set the jar file directory using a file name pattern.
|
public JarDependencies()
public JarDependencies(java.io.File dir, java.lang.String rootname, boolean acceptUnversioned) throws java.io.IOException
dir
- the directory where to look for the jar filerootname
- the root name of the jar fileacceptUnversioned
- true if unversioned jar files must be allowedjava.io.IOException
- if the Jar file does not exist or is unreadable, or is not a Jar filepublic JarDependencies(java.io.File dir, java.lang.String rootname, boolean acceptUnversioned, short separatorType) throws java.io.IOException
dir
- the directory where to look for the jar filerootname
- the root name of the jar fileacceptUnversioned
- true if unversioned jar files must be allowedseparatorType
- the separator which is used to separate the pattern elements. See NamePatternSeparator
java.io.IOException
- if the Jar file does not exist or is unreadable, or is not a Jar filepublic JarDependencies(java.io.File file) throws java.io.IOException
file
- the jar filejava.io.IOException
- if the Jar file does not exist or is unreadable, or is not a Jar filepublic final void setFile(java.io.File file) throws java.io.IOException
file
- the jar file or class files directoryjava.io.IOException
- if the Jar file does not exist or is unreadable, or is not a Jar filepublic final void setFile(java.io.File dir, java.lang.String rootname, boolean acceptUnversioned, short separatorType) throws java.io.IOException
dir
- the directory where to look for the jar filerootname
- the root name of the jar fileacceptUnversioned
- true if unversioned jar files must be allowedseparatorType
- the separator typejava.io.IOException
- if the Jar file does not exist or is unreadable, or is not a Jar filepublic final void setFile(java.io.File dir, java.lang.String rootname, boolean acceptUnversioned) throws java.io.IOException
dir
- the directory where to look for the jar filerootname
- the root name of the jar fileacceptUnversioned
- true if unversioned jar files must be allowedjava.io.IOException
- if the Jar file does not exist or is unreadable, or is not a Jar filepublic java.lang.String getName()
public java.io.File getFile()
public java.util.Map<java.lang.String,java.util.Set<java.lang.String>> getDependencies()
org.mypackage.MyPanel
:
import javax.swing.JPanel public class MyPanel extends JPanel() { public MyPanel() { super(); } }In this case there is only one class
org.mypackage.MyPanel
, and this class has only one
dependency: javax.swing.JPanel
. The method will return a Map with only one element.public java.util.Map<java.lang.String,java.lang.Integer> getClassesAccess()
public java.util.Set<java.lang.String> getPackageNames()
public boolean hasDefaultPackage()
public java.util.Set<java.lang.String> getPaths()
public boolean containsPath(java.lang.String path)
path
- the pathpublic boolean isJarFile()
public java.util.jar.Manifest getManifest()
public ClassDependencies getDependenciesOn(java.lang.String pack, boolean isStrict)
pack
- the packageisStrict
- true if subpackages of the specified package will not be considered in the filterpublic java.util.Map<java.lang.String,ClassDependencies> getDependencies(JarDependencies jarDepend)
jarDepend
- the other JarDependenciespublic java.util.Map<java.lang.String,ClassDependencies> getDependencies(java.util.List<JarDependencies> jarList)
jarList
- the list of JarDependenciespublic boolean isDependingOn(JarDependencies dependencies)
dependencies
- the jar file or class files directory which we seek to look if this jar file is depending on
itpublic boolean isDependingOn(JarDependencies dependencies, java.lang.String packagePath)
dependencies
- the jar file or class files directory which we seek to look if this jar file is depending on
itpackagePath
- the package which we will use to filter the classes in the Jar to checkpublic boolean isDependingOn(JarDependencies dependencies, java.lang.String packagePath, boolean isStrict)
dependencies
- the jar file or class files directory which we seek to look if this jar file is depending on
itpackagePath
- the package which we will use to filter the classes in the Jar to checkisStrict
- true if sub-packages of the specified package will not be considered in the filterpublic boolean isDependingOn(java.lang.String pack) throws java.io.IOException
pack
- the packagejava.io.IOException
- if the Jar file does not exist or is unreadable, or is not a Jar filepublic boolean isDependingOn(java.util.Set<java.lang.String> packages) throws java.io.IOException
packages
- the Set of packagesjava.io.IOException
- if the Jar file does not exist or is unreadable, or is not a Jar filepublic ClassDependencies dependenciesFrom(JarDependencies dependencies)
dependencies
- the jar file or class files directory which we seek to look if this jar file is depending on
itpublic ClassDependencies dependenciesFrom(JarDependencies dependencies, java.lang.String packagePath)
dependencies
- the jar file or class files directory which we seek to look if this jar file is depending on
itpackagePath
- the package where we look for dependenciespublic ClassDependencies dependenciesFrom(JarDependencies dependencies, java.lang.String packagePath, boolean isStrict)
dependencies
- the jar file or class files directory which we seek to look if this jar file is depending on
itpackagePath
- the package where we look for dependenciesisStrict
- true if subpackages of the specified package will not be considered in the filterCopyright © 2016-2023 Herve Girod. All Rights Reserved. Documentation and source under the LGPL licence