Class FileSystemClassInformationRepository
- java.lang.Object
-
- com.offbynull.coroutines.instrumenter.asm.FileSystemClassInformationRepository
-
- All Implemented Interfaces:
ClassInformationRepository
public final class FileSystemClassInformationRepository extends java.lang.Object implements ClassInformationRepository
Provides information on classes contained within JARs and folders.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,ClassInformation>hierarchyMap
-
Constructor Summary
Constructors Constructor Description FileSystemClassInformationRepository()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddClasspath(java.util.List<java.io.File> classpath)Add classes contained within a list of JAR files and folders.private voidaddDirectory(java.io.File directory)voidaddIndividual(java.lang.String className, ClassInformation classInformation)Add a custom class.private voidaddJar(java.io.File file)static FileSystemClassInformationRepositorycreate(java.util.List<java.io.File> initialClasspath)Constructs aFileSystemClassInformationRepositoryobject and loads it up with the classes in a classpath.ClassInformationgetInformation(java.lang.String internalClassName)Get information for a class.private voidpopulateSuperClassMapping(java.io.InputStream is)
-
-
-
Field Detail
-
hierarchyMap
private final java.util.Map<java.lang.String,ClassInformation> hierarchyMap
-
-
Method Detail
-
create
public static FileSystemClassInformationRepository create(java.util.List<java.io.File> initialClasspath) throws java.io.IOException
Constructs aFileSystemClassInformationRepositoryobject and loads it up with the classes in a classpath.- Parameters:
initialClasspath- classpath to scan for class information (can be JAR files and/or folders)- Returns:
- newly created
FileSystemClassInformationRepositoryobject - Throws:
java.lang.NullPointerException- if any argument isnullor containsnullelementsjava.io.IOException- if an IO error occurs
-
getInformation
public ClassInformation getInformation(java.lang.String internalClassName)
Description copied from interface:ClassInformationRepositoryGet information for a class.This method returns class information as if it were encountered in a class file. In a class file, if the class is an interface, then its superclass is set to
Object. Note that this is different from whatClass.getSuperclass()returns when the class represents an interface (it returnsnull).- Specified by:
getInformationin interfaceClassInformationRepository- Parameters:
internalClassName- internal class name- Returns:
- information for that class, or
nullif not found
-
addIndividual
public void addIndividual(java.lang.String className, ClassInformation classInformation)Add a custom class.- Parameters:
className- name of classclassInformation- information for class- Throws:
java.lang.NullPointerException- if any argument isnulljava.lang.IllegalArgumentException- ifclassNamealready exists in this repository
-
addClasspath
public void addClasspath(java.util.List<java.io.File> classpath) throws java.io.IOExceptionAdd classes contained within a list of JAR files and folders. Note that if a duplicate class is encountered, the original is kept.- Parameters:
classpath- list of JARs and folders to scan- Throws:
java.lang.NullPointerException- if any argument isnullor containsnullelementsjava.io.IOException- if an IO error occurs
-
addDirectory
private void addDirectory(java.io.File directory) throws java.io.IOException- Throws:
java.io.IOException
-
addJar
private void addJar(java.io.File file) throws java.io.IOException- Throws:
java.io.IOException
-
populateSuperClassMapping
private void populateSuperClassMapping(java.io.InputStream is) throws java.io.IOException- Throws:
java.io.IOException
-
-