private void process(List<Module> modules) { Map<String, Module> byName = Maps.uniqueIndex(modules, new Function<Module, String>() { @Override public String apply(Module input) { return input.getName(); } });
/** * Get a string representation of the given module, used in debug output and stack traces. This method may be * overridden to provide a more detailed description. By default it returns a string consisting of the module's * name and version (if any). * * @param module the module to describe * @return the description string */ public String getModuleDescription(final Module module) { final Version version = module.getVersion(); return version == null ? module.getName() : module.getName() + "@" + version; }
private TextView getModuleNameView(Module module) { TextView view = new TextView(context); view.setText(module.getName()); params.addRule(RelativeLayout.RIGHT_OF, 1); view.setLayoutParams(params); return view; }
while (it.hasNext() ) { Module module = (Module) it.next(); if (module.getStudents().contains(student)) { System.out.printf("%s ", module.getName()); break; }
Boolean found = false; while (it.hasNext() && !found) { Module module = (Module) it.next(); if (module.getStudents().contains(student)) { System.out.printf("%s ", module.getName()); found = true; }
/** * Get this module's identifier. * * @return the identifier * @deprecated Use {@link #getName()} instead. */ @Deprecated public ModuleIdentifier getIdentifier() { return ModuleIdentifier.fromString(getName()); }
public static String getClassLoaderModuleName(ClassLoader classLoader) { if (classLoader instanceof ModuleClassLoader) { ModuleClassLoader moduleClassLoader = (ModuleClassLoader) classLoader; return moduleClassLoader.getModule().getName(); } throw new IllegalArgumentException("ClassLoader must be of type ModuleClassLoader"); } }
public static String getClassLoaderModuleName(ClassLoader classLoader) { if (classLoader instanceof ModuleClassLoader) { ModuleClassLoader moduleClassLoader = (ModuleClassLoader) classLoader; return moduleClassLoader.getModule().getName(); } throw new IllegalArgumentException("ClassLoader must be of type ModuleClassLoader"); } }
Map<String, DateTime> map = new HashMap<>(); for (Module module : sortedList) { map.put(module.getName(), module.getDate()); }
/** * Get the string representation of this module. * * @return the string representation */ @Override public String toString() { StringBuilder b = new StringBuilder(); b.append("Module \""); b.append(getName()); b.append("\""); if (version != null) { b.append(" version ").append(version); } b.append(" from ").append(moduleLoader); return b.toString(); }
/** * Unload a module from this module loader. Note that this has no effect on existing modules which refer to the * module being unloaded. Also, only modules from the current module loader can be unloaded. Unloading the same * module more than once has no additional effect. This method only removes the mapping for the module; any running * threads which are currently accessing or linked to the module will continue to function, however attempts to load * this module will fail until a new module is loaded with the same name. Once this happens, if all references to * the previous module are not cleared, the same module may be loaded more than once, causing possible class duplication * and class cast exceptions if proper care is not taken. * * @param module the module to unload * @throws SecurityException if an attempt is made to unload a module which does not belong to this module loader * @throws SecurityException if the module was not defined by this module loader * @deprecated use {@link #unloadModuleLocal(String,Module)} instead */ @Deprecated protected final void unloadModuleLocal(Module module) throws SecurityException { if (module == null) { throw new NullPointerException("Module parameter cannot be null"); } unloadModuleLocal(module.getName(), module); }
private XMLStreamException loadModule(final String moduleName, final XMLMapper xmlMapper) throws XMLStreamException { // Register element handlers for this extension try { final Module module = moduleLoader.loadModule(ModuleIdentifier.fromString(moduleName)); boolean initialized = false; for (final Extension extension : module.loadService(Extension.class)) { ClassLoader oldTccl = WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(extension.getClass()); try { extensionRegistry.initializeParsers(extension, moduleName, xmlMapper); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); } if (!initialized) { initialized = true; } } if (!initialized) { throw ControllerLogger.ROOT_LOGGER.notFound("META-INF/services/", Extension.class.getName(), module.getName()); } return null; } catch (final ModuleLoadException e) { throw ControllerLogger.ROOT_LOGGER.failedToLoadModule(e); } }
private static void calculateModule(final ExtLogRecord logRecord, final Class<?> clazz) { final Module module = Module.forClass(clazz); if (module != null) { logRecord.setSourceModuleName(module.getName()); final Version version = module.getVersion(); if (version != null) { logRecord.setSourceModuleVersion(version.toString()); } else { logRecord.setSourceModuleVersion(null); } } } }
private XMLStreamException loadModule(final String moduleName, final XMLMapper xmlMapper) throws XMLStreamException { // Register element handlers for this extension try { final Module module = moduleLoader.loadModule(ModuleIdentifier.fromString(moduleName)); boolean initialized = false; for (final Extension extension : module.loadService(Extension.class)) { ClassLoader oldTccl = WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(extension.getClass()); try { extensionRegistry.initializeParsers(extension, moduleName, xmlMapper); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); } if (!initialized) { initialized = true; } } if (!initialized) { throw ControllerLogger.ROOT_LOGGER.notFound("META-INF/services/", Extension.class.getName(), module.getName()); } return null; } catch (final ModuleLoadException e) { throw ControllerLogger.ROOT_LOGGER.failedToLoadModule(e); } }