Class ClassNameConflictAnalyzer

java.lang.Object
ch.grengine.code.ClassNameConflictAnalyzer

public class ClassNameConflictAnalyzer extends Object
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 Details

    • getAllClassNamesMap

      public static Map<String,List<Code>> getAllClassNamesMap(List<Code> codeLayers)
      gets a map of class name to a list of all Code layers 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 all Code layers 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 all Code layers 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 loader
      codeLayers - 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