org.jboss.modules.ModuleDependencySpec Java Examples

The following examples show how to use org.jboss.modules.ModuleDependencySpec. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JBossModuleLoader.java    From Nicobar with Apache License 2.0 6 votes vote down vote up
/**
 * Extract the Module dependencies for the given module in the form
 * of ScriptModule ids.
 */
public static Set<ModuleId> getDependencyScriptModuleIds(ModuleSpec moduleSpec) {
    Objects.requireNonNull(moduleSpec, "moduleSpec");
    if (!(moduleSpec instanceof ConcreteModuleSpec)) {
        throw new IllegalArgumentException("Unsupported ModuleSpec implementation: " + moduleSpec.getClass().getName());
    }
    Set<ModuleId> dependencyNames = new LinkedHashSet<ModuleId>();
    ConcreteModuleSpec concreteSpec = (ConcreteModuleSpec)moduleSpec;
    for (DependencySpec dependencSpec : concreteSpec.getDependencies()) {
        if (dependencSpec instanceof ModuleDependencySpec) {
            ModuleIdentifier revisionId = ((ModuleDependencySpec)dependencSpec).getIdentifier();
            dependencyNames.add(ModuleId.fromString(revisionId.getName()));
        }
    }
    return dependencyNames;
}