Class JavaModuleIdentifierFactory

java.lang.Object
sootup.java.core.JavaIdentifierFactory
sootup.java.core.JavaModuleIdentifierFactory
All Implemented Interfaces:
IdentifierFactory

public class JavaModuleIdentifierFactory extends JavaIdentifierFactory
  • Field Details

  • Constructor Details

    • JavaModuleIdentifierFactory

      public JavaModuleIdentifierFactory()
  • Method Details

    • forModule

      public @NonNull JavaModuleIdentifierFactory forModule(@NonNull String module)
      Returns a view on this factory that resolves class names without an explicit module to module. The wrappers are cached per factory instance, so they are released together with the JavaModuleView this factory belongs to.
      Parameters:
      module - the name of the default module
      Returns:
      a factory that resolves module-less class names to module
    • forModule

      public @NonNull JavaModuleIdentifierFactory forModule(@NonNull ModuleSignature moduleSignature)
      Returns a view on this factory that resolves class names without an explicit module to moduleSignature.
      Parameters:
      moduleSignature - the signature of the default module
      Returns:
      a factory that resolves module-less class names to moduleSignature
    • isMainSubSignature

      public boolean isMainSubSignature(@NonNull MethodSubSignature methodSubSignature)
      Description copied from interface: IdentifierFactory
      Checks whether the given method sub signature is the main method signature
      Specified by:
      isMainSubSignature in interface IdentifierFactory
      Overrides:
      isMainSubSignature in class JavaIdentifierFactory
      Returns:
    • getClassType

      public ModuleJavaClassType getClassType(String className, String packageName)
      Description copied from class: JavaIdentifierFactory
      Returns a unique ClassType. The method looks up a cache if it already contains a ClassType with the given name/package. If the cache lookup fails a new ClassType is created. This lets callers compare ClassTypes with ==.
      Specified by:
      getClassType in interface IdentifierFactory
      Overrides:
      getClassType in class JavaIdentifierFactory
      Parameters:
      className - the simple class name
      packageName - the Java package name; must not be null use empty string for the default package PackageName.DEFAULT_PACKAGE the Java package name
      Returns:
      a ClassSignature for a Java class
    • getClassType

      public ModuleJavaClassType getClassType(String fullyQualyfiedClassNameWithModule)
      Description copied from class: JavaIdentifierFactory
      Always creates a new ClassSignature.
      Specified by:
      getClassType in interface IdentifierFactory
      Overrides:
      getClassType in class JavaIdentifierFactory
      Parameters:
      fullyQualyfiedClassNameWithModule - the fully-qualified name of the class
      Returns:
      a ClassSignature for a Java Class
    • getClassType

      public ModuleJavaClassType getClassType(@NonNull String className, @NonNull String packageName, @NonNull String moduleName)
      Returns a unique ClassType. The method looks up a cache if it already contains a ClassType with the given name/package/module. If the cache lookup fails a new ClassType is created. This lets callers compare ClassTypes with ==.
      Parameters:
      className - the simple name of the class
      packageName - the declaring package
      moduleName - the declaring module
      Returns:
      a ClassSignature for a Java 9 class
      Throws:
      NullPointerException - if the given module name or package name is null. Use the empty string to denote the unnamed module or the default package.
    • getClassType

      public ModuleJavaClassType getClassType(@NonNull String className, @NonNull String packageName, @NonNull ModuleSignature moduleSignature)
    • getModuleSignature

      public static ModuleSignature getModuleSignature(@NonNull String moduleName)
      Returns a unique ModuleSignature. The method looks up a cache if it already contains a signature with the given module name. If the cache lookup fails a new signature is created. Returns a unique ModuleSignature. The method looks up a cache if it already contains a signature with the given module name. If the cache lookup fails a new signature is created.
      Parameters:
      moduleName - the module name; Must not be null. Use the empty string for the unnamed module
      Returns:
      a ModuleSignature
      Throws:
      NullPointerException - if the given module name is null. Use the empty string to denote the unnamed module.
    • getPackageName

      public ModulePackageName getPackageName(@NonNull String packageName)
      Description copied from class: JavaIdentifierFactory
      Returns a unique PackageName. The method looks up a cache if it already contains a signature with the given package name. If the cache lookup fails a new signature is created.
      Specified by:
      getPackageName in interface IdentifierFactory
      Overrides:
      getPackageName in class JavaIdentifierFactory
      Parameters:
      packageName - the Java package name; must not be null use empty string for the default package PackageName.DEFAULT_PACKAGE
      Returns:
      a PackageName
    • getPackageName

      public ModulePackageName getPackageName(@NonNull String packageName, @NonNull String moduleName)
      Returns a unique PackageName. The methodRef looks up a cache if it already contains a signature with the given package and module name. If the cache lookup fails a new signature is created.
      Parameters:
      packageName - the package name; must not be null use empty string for the default package
      moduleName - the module containing the package; must not be null use empty string for the unnamed module ModuleSignature.UNNAMED_MODULE
      Returns:
      a ModulePackageName
      Throws:
      NullPointerException - if the given module name or package name is null. Use the empty string to denote the unnamed module or the default package.
    • getPackageName

      public ModulePackageName getPackageName(@NonNull String packageName, @NonNull ModuleSignature moduleSignature)