Package ch.grengine.code
Class ClassNameConflictAnalyzer
java.lang.Object
ch.grengine.code.ClassNameConflictAnalyzer
Helper class for analyzing class name conflicts.
Can identify classes with the same name in different code layers or in code layers and a parent class loader.
- Since:
- 1.0
- Author:
- Alain Stalder, Made in Switzerland.
-
Method Summary
Modifier and TypeMethodDescriptiongetAllClassNamesMap(List<Code> codeLayers) gets a map of class name to a list of allCodelayers that contain a class with that name.getSameClassNamesInMultipleCodeLayersMap(List<Code> codeLayers) gets a map of class name to a list of allCodelayers that contain a class with that name, but only if the class name occurs more than once in the code layers.getSameClassNamesInParentAndCodeLayersMap(ClassLoader parent, List<Code> codeLayers) gets a map of class name to a list of allCodelayers that contain a class with that name, but only if the class name occurs also in the given parent class loader.
-
Method Details
-
getAllClassNamesMap
gets a map of class name to a list of allCodelayers that contain a class with that name.- Parameters:
codeLayers- code layers- Returns:
- map of class name to list of code layers
- Throws:
NullPointerException- if code layers are null- Since:
- 1.0
-
getSameClassNamesInMultipleCodeLayersMap
public static Map<String,List<Code>> getSameClassNamesInMultipleCodeLayersMap(List<Code> codeLayers) gets a map of class name to a list of allCodelayers that contain a class with that name, but only if the class name occurs more than once in the code layers.- Parameters:
codeLayers- code layers- Returns:
- map of class name to list of code layers
- Throws:
NullPointerException- if code layers are null- Since:
- 1.0
-
getSameClassNamesInParentAndCodeLayersMap
public static Map<String,List<Code>> getSameClassNamesInParentAndCodeLayersMap(ClassLoader parent, List<Code> codeLayers) gets a map of class name to a list of allCodelayers that contain a class with that name, but only if the class name occurs also in the given parent class loader.Note that this method tries to load all of these classes by name from the parent class loader.
- Parameters:
parent- parent class loadercodeLayers- code layers- Returns:
- map of class name to list of code layers
- Throws:
NullPointerException- if the parent class loader or code layers are null- Since:
- 1.0
-