com.atlassian.confluence.util.classpath
Class ClasspathJarSets

java.lang.Object
  extended by com.atlassian.confluence.util.classpath.ClasspathJarSets
All Implemented Interfaces:
DuplicateClassFinder

public class ClasspathJarSets
extends java.lang.Object
implements DuplicateClassFinder

Contains a set of JAR files for each class on the classpath: the set of JARs that contain the class.

Ideally, a set of JARs for a given class should only include one JAR; if the set of JARs for a given class includes more than one JAR, the class is duplicated in several JARs in the classpath.


Constructor Summary
ClasspathJarSets()
           
ClasspathJarSets(ClasspathClasses classpathClasses)
           
ClasspathJarSets(ClasspathClasses classpathClasses, org.apache.commons.collections.Predicate classFileNamePredicate)
           
 
Method Summary
 void addClass(java.lang.String classFileName, JarSet jars)
           
 java.util.SortedSet getClassFileNames(JarSet jars)
          Returns the class files in a given set of JARs, which may be one or more JARs.
 java.util.Set getJarSetsWithCommonClasses()
           
 java.util.SortedSet getPackageNames(JarSet jars)
          Returns the packages in a given set of JARs, which may be one or more JARs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClasspathJarSets

public ClasspathJarSets()

ClasspathJarSets

public ClasspathJarSets(ClasspathClasses classpathClasses)

ClasspathJarSets

public ClasspathJarSets(ClasspathClasses classpathClasses,
                        org.apache.commons.collections.Predicate classFileNamePredicate)
Method Detail

addClass

public void addClass(java.lang.String classFileName,
                     JarSet jars)

getJarSetsWithCommonClasses

public java.util.Set getJarSetsWithCommonClasses()
Specified by:
getJarSetsWithCommonClasses in interface DuplicateClassFinder
Returns:
the sets of JARs which have classes in common, i.e. any JarSet containing more than one JAR

getClassFileNames

public java.util.SortedSet getClassFileNames(JarSet jars)
Returns the class files in a given set of JARs, which may be one or more JARs.

The set is sorted by the natural order of the contents: the String class file names.

Specified by:
getClassFileNames in interface DuplicateClassFinder
Parameters:
jars - a set of one or more JARs on the classpath
Returns:
the class files in the JarSet. Each is a String in the form "java/lang/String.class". Returns an empty set if no classes are in that JarSet.

getPackageNames

public java.util.SortedSet getPackageNames(JarSet jars)
Returns the packages in a given set of JARs, which may be one or more JARs. Each package is in the form "java/lang".

The set is sorted by the natural order of the contents: the String package names.

Specified by:
getPackageNames in interface DuplicateClassFinder
Parameters:
jars - a set of one or more JARs on the classpath
Returns:
the packages found in the JarSet. Each is a String in the form "java/lang". Returns an empty set if no classes are in that JarSet.


Copyright © 2003-2008 Atlassian Pty Ltd. All Rights Reserved.