org.jboss.modules.Module.forClassLoader()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(93)

本文整理了Java中org.jboss.modules.Module.forClassLoader()方法的一些代码示例,展示了Module.forClassLoader()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Module.forClassLoader()方法的具体详情如下:
包路径:org.jboss.modules.Module
类名称:Module
方法名:forClassLoader

Module.forClassLoader介绍

[英]Get the module for a class loader, or null if the class loader is not associated with any module. If the class loader is unknown, it is possible to check the parent class loader up the chain, and so on until a module is found.
[中]获取类加载器的模块,如果类加载器未与任何模块关联,则为null。如果类加载器未知,可以检查链上的父类加载器,依此类推,直到找到模块。

代码示例

代码示例来源:origin: org.jboss.forge/jboss-modules

/**
 * Get the module for a loaded class, or {@code null} if the class did not come from any module.
 *
 * @param clazz the class
 * @return the module it came from
 */
public static Module forClass(Class<?> clazz) {
  final ClassLoader cl = clazz.getClassLoader();
  return forClassLoader(cl, false);
}

代码示例来源:origin: org.jboss.modules/jboss-modules

/**
 * Get the module for a loaded class, or {@code null} if the class did not come from any module.
 *
 * @param clazz the class
 * @return the module it came from
 */
public static Module forClass(Class<?> clazz) {
  final ClassLoader cl = clazz.getClassLoader();
  return forClassLoader(cl, false);
}

代码示例来源:origin: org.jboss.modules/jboss-modules

/**
 * Get the current thread's context module loader.  This loader is the one which defined the module
 * whose class loader is, or is a parent of, the thread's current context class loader.  If there is none,
 * then {@code null} is returned.
 *
 * @return the module loader, or {@code null} if none is set
 */
public static ModuleLoader getContextModuleLoader() {
  return Module.forClassLoader(Thread.currentThread().getContextClassLoader(), true).getModuleLoader();
}

代码示例来源:origin: org.jboss.forge/jboss-modules

/**
 * Get the current thread's context module loader.  This loader is the one which defined the module
 * whose class loader is, or is a parent of, the thread's current context class loader.  If there is none,
 * then {@code null} is returned.
 *
 * @return the module loader, or {@code null} if none is set
 */
public static ModuleLoader getContextModuleLoader() {
  return Module.forClassLoader(Thread.currentThread().getContextClassLoader(), true).getModuleLoader();
}

代码示例来源:origin: org.jboss.modules/jboss-modules

/**
 * Get the module loader for a class loader.
 *
 * @param classLoader the class loader
 *
 * @return the module loader or {@code null} if the class loader does not belong to a module loader.
 */
public static ModuleLoader forClassLoader(ClassLoader classLoader) {
  final Module module = Module.forClassLoader(classLoader, true);
  if (module == null) {
    return null;
  }
  return module.getModuleLoader();
}

代码示例来源:origin: org.jboss.forge/jboss-modules

/**
 * Get the module loader for a class loader.
 *
 * @param classLoader the class loader
 *
 * @return the module loader or {@code null} if the class loader does not belong to a module loader.
 */
public static ModuleLoader forClassLoader(ClassLoader classLoader) {
  final Module module = Module.forClassLoader(classLoader, true);
  if (module == null) {
    return null;
  }
  return module.getModuleLoader();
}

代码示例来源:origin: org.jboss.modules/jboss-modules

/**
 * Get the module for a class loader, or {@code null} if the class loader is not associated with any module.  If
 * the class loader is unknown, it is possible to check the parent class loader up the chain, and so on until a module is found.
 *
 * @param cl the class loader
 * @param search {@code true} to search up the delegation chain
 * @return the associated module
 */
public static Module forClassLoader(ClassLoader cl, boolean search) {
  if (cl instanceof ModuleClassLoader) {
    return ((ModuleClassLoader) cl).getModule();
  } else if (search && cl != null) {
    return forClassLoader(cl.getParent(), true);
  } else {
    return null;
  }
}

代码示例来源:origin: org.jboss.forge/jboss-modules

/**
 * Get the module for a class loader, or {@code null} if the class loader is not associated with any module.  If
 * the class loader is unknown, it is possible to check the parent class loader up the chain, and so on until a module is found.
 *
 * @param cl the class loader
 * @param search {@code true} to search up the delegation chain
 * @return the associated module
 */
public static Module forClassLoader(ClassLoader cl, boolean search) {
  if (cl instanceof ModuleClassLoader) {
    return ((ModuleClassLoader) cl).getModule();
  } else if (search) {
    return forClassLoader(cl.getParent(), true);
  } else {
    return null;
  }
}

代码示例来源:origin: org.jboss.ws.cxf/jbossws-cxf-client

Module module = Module.forClassLoader(moduleclassLoader, true);
if (module == null)

代码示例来源:origin: org.jboss.forge/forge-shell

composite.add(Module.forClassLoader(Bootstrap.class.getClassLoader(), true).getClassLoader());

代码示例来源:origin: com.camunda.fox.platform/fox-platform-jboss-subsystem

Module module = Module.forClassLoader(classLoader, true);
ModuleIdentifier moduleIdentifier = module.getIdentifier();
ServiceName moduleServiceName = ServiceModuleLoader.moduleServiceName(moduleIdentifier);

相关文章