restx.build.ModuleDescriptor Maven / Gradle / Ivy
package restx.build;
import java.util.*;
/**
* User: xavierhanin
* Date: 4/14/13
* Time: 2:07 PM
*/
public class ModuleDescriptor {
private final GAV parent;
private final GAV gav;
private final String packaging;
private final Map properties;
private final Map> fragments;
private final Map> dependencies;
public ModuleDescriptor(GAV parent, GAV gav, String packaging,
Map properties,
Map> fragments,
Map> dependencies) {
this.parent = parent;
this.gav = gav;
this.packaging = packaging;
this.fragments = Collections.unmodifiableMap(fragments);
this.properties = Collections.unmodifiableMap(properties);
this.dependencies = Collections.unmodifiableMap(dependencies);
}
public GAV getParent() {
return parent;
}
public GAV getGav() {
return gav;
}
public String getPackaging() {
return packaging;
}
public Map getProperties() {
return properties;
}
public Set getDependencyScopes() {
return dependencies.keySet();
}
public List getDependencies(String scope) {
return dependencies.get(scope);
}
public List getFragments(String s) {
List moduleFragments = fragments.get(s);
return moduleFragments == null ? Collections.emptyList() : moduleFragments;
}
public ModuleDescriptor concatDependency(String scope, ModuleDependency dep) {
LinkedHashMap> newDeps = new LinkedHashMap<>(dependencies);
if (!newDeps.containsKey(scope)) {
newDeps.put(scope, new ArrayList());
} else {
newDeps.put(scope, new ArrayList(newDeps.get(scope)));
}
newDeps.get(scope).add(dep);
return new ModuleDescriptor(parent, gav, packaging, properties, fragments, newDeps);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy