Class ZClassContext
java.lang.Object
dxt.scanpath.v2.bc.ZClassContext
Provides access to class metadata discovered from configured classpath locations.
A context maintains the configured BinSource instances, an index of their
BinFile entries, and the ZClass instances created from those entries. Call
prepareIndex() after adding class paths and before querying class names or metadata.
- Author:
- indroneel
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty class context with no configured class-path locations. -
Method Summary
Modifier and TypeMethodDescriptionvoidappendClassPath(String path) Adds a class-path location to this context.voidclose()Clears the indexed class files and cached class metadata.Retrieves metadata for a class by fully qualified name.Lists the fully qualified names of the class files in the current index.voidRebuilds the class-file index from all classpath locations currently configured.
-
Constructor Details
-
ZClassContext
public ZClassContext()Creates an empty class context with no configured class-path locations.
-
-
Method Details
-
appendClassPath
Adds a class-path location to this context.Paths ending in
.zipor.jarare treated as archive files. Other paths are treated as directories. The location is not indexed untilprepareIndex()is called. Invalid or unreadable locations are ignored after a warning is logged.- Parameters:
path- the path to a class-file directory, ZIP archive, or JAR archive
-
prepareIndex
public void prepareIndex()Rebuilds the class-file index from all classpath locations currently configured. Rebuilding also discards all previously createdZClassinstances. -
close
public void close()Clears the indexed class files and cached class metadata.Configured classpath locations remain available and can be indexed again by calling
prepareIndex(). -
listClassNames
-
getZClass
Retrieves metadata for a class by fully qualified name.If the class is present in the current index, its bytecode is parsed and the resulting metadata is cached. If it is not indexed, a placeholder
ZClassis created and cached.- Parameters:
clsName- the fully qualified class name- Returns:
- the cached or newly created class metadata
-