Class ModuleUtils

java.lang.Object
org.litebridge.commons.ModuleUtils

public class ModuleUtils extends Object
Utility class for Java Module System (JPMS) related operations.
  • Method Details

    • requireAccessible

      public static <T> Class<T> requireAccessible(Class<T> dtoClass)
      Ensures that the specified class is accessible to the current module.
      Type Parameters:
      T - the type of the class
      Parameters:
      dtoClass - the class to check for accessibility
      Returns:
      the specified class if it is accessible
      Throws:
      IllegalArgumentException - if the class is not accessible
    • requireAccessible

      public static <T> Class<T> requireAccessible(Class<T> dtoClass, Module targetModule)
      Ensures that the specified class is accessible to the target module.
      Type Parameters:
      T - the type of the class
      Parameters:
      dtoClass - the class to check for accessibility
      targetModule - the module that needs access to the class
      Returns:
      the specified class if it is accessible
      Throws:
      IllegalArgumentException - if the class is not accessible