@Test public void with() { DependencyAtom dependencyAtom = new DependencyAtom("net.ocheyedan", "ply", "1.0"); DependencyAtom transformed = dependencyAtom.with(null); assertEquals("net.ocheyedan", transformed.namespace); assertEquals("ply", transformed.name); assertEquals("1.0", transformed.version); assertNull(transformed.artifactName); transformed = dependencyAtom.with(DependencyAtom.DEFAULT_PACKAGING); assertEquals("net.ocheyedan", transformed.namespace); assertEquals("ply", transformed.name); assertEquals("1.0", transformed.version); assertNull(transformed.artifactName); transformed = dependencyAtom.with("zip"); assertEquals("net.ocheyedan", transformed.namespace); assertEquals("ply", transformed.name); assertEquals("1.0", transformed.version); assertEquals("ply-1.0.zip", transformed.artifactName); dependencyAtom = dependencyAtom.withClassifier("sources"); transformed = dependencyAtom.with("zip"); assertEquals("net.ocheyedan", transformed.namespace); assertEquals("ply", transformed.name); assertEquals("1.0", transformed.version); assertEquals("ply-1.0-sources.zip", transformed.artifactName); dependencyAtom = new DependencyAtom(dependencyAtom.namespace, dependencyAtom.name, dependencyAtom.version, "customName"); transformed = dependencyAtom.with("zip"); assertEquals("net.ocheyedan", transformed.namespace); assertEquals("ply", transformed.name); assertEquals("1.0", transformed.version); assertEquals("customName.zip", transformed.artifactName); }
public DependencyAtom with(String packaging) { if ((packaging == null) || DEFAULT_PACKAGING.equals(packaging)) { return new DependencyAtom(namespace, name, version, transientDep); } else if (artifactName == null) { return new DependencyAtom(namespace, name, version, composeArtifact(name, version, null, packaging), transientDep); } else { int index = artifactName.lastIndexOf("."); if (index == -1) { return new DependencyAtom(namespace, name, version, artifactName + "." + packaging, transientDep); } else { String artifactWithoutPackaging = artifactName.substring(0, index); return new DependencyAtom(namespace, name, version, artifactWithoutPackaging + "." + packaging, transientDep); } } }
DependencyAtom { public DependencyAtom with(String packaging) { if ((packaging == null) || DEFAULT_PACKAGING.equals(packaging)) { return new DependencyAtom(namespace, name, version, transientDep); } else if (artifactName == null) { return new DependencyAtom(namespace, name, version, composeArtifact(name, version, null, packaging), transientDep); } else { int index = artifactName.lastIndexOf("."); if (index == -1) { return new DependencyAtom(namespace, name, version, artifactName + "." + packaging, transientDep); } else { String artifactWithoutPackaging = artifactName.substring(0, index); return new DependencyAtom(namespace, name, version, artifactWithoutPackaging + "." + packaging, transientDep); } } } }
DependencyAtom { public DependencyAtom with(String packaging) { if ((packaging == null) || DEFAULT_PACKAGING.equals(packaging)) { return new DependencyAtom(namespace, name, version, transientDep); } else if (artifactName == null) { return new DependencyAtom(namespace, name, version, composeArtifact(name, version, null, packaging), transientDep); } else { int index = artifactName.lastIndexOf("."); if (index == -1) { return new DependencyAtom(namespace, name, version, artifactName + "." + packaging, transientDep); } else { String artifactWithoutPackaging = artifactName.substring(0, index); return new DependencyAtom(namespace, name, version, artifactWithoutPackaging + "." + packaging, transientDep); } } } DependencyAtom(String namespace, String name, String version, String artifactName, boolean transientDep);  DependencyAtom(String namespace, String name, String version, String artifactName);  DependencyAtom(String namespace, String name, String version, boolean transientDep);  DependencyAtom(String namespace, String name, String version); }
DependencyAtom { public DependencyAtom with(String packaging) { if ((packaging == null) || DEFAULT_PACKAGING.equals(packaging)) { return new DependencyAtom(namespace, name, version, transientDep); } else if (artifactName == null) { return new DependencyAtom(namespace, name, version, composeArtifact(name, version, null, packaging), transientDep); } else { int index = artifactName.lastIndexOf("."); if (index == -1) { return new DependencyAtom(namespace, name, version, artifactName + "." + packaging, transientDep); } else { String artifactWithoutPackaging = artifactName.substring(0, index); return new DependencyAtom(namespace, name, version, artifactWithoutPackaging + "." + packaging, transientDep); } } } DependencyAtom(String namespace, String name, String version, String artifactName, boolean transientDep);  DependencyAtom(String namespace, String name, String version, String artifactName);  DependencyAtom(String namespace, String name, String version, boolean transientDep);  DependencyAtom(String namespace, String name, String version); String getPropertyName(); String getPropertyValue(); String getPropertyValueWithoutTransient(); String getResolvedPropertyValue(); String getArtifactName(); DependencyAtom with(String packaging); DependencyAtom withClassifier(String classifier); DependencyAtom withoutClassifier(); String getClassifier(); String getSyntheticPackaging(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static boolean isTransient(String atom); static String stripTransient(String atom); static DependencyAtom parse(String atom, AtomicReference<String> error); }
DependencyAtom { public DependencyAtom with(String packaging) { if ((packaging == null) || DEFAULT_PACKAGING.equals(packaging)) { return new DependencyAtom(namespace, name, version, transientDep); } else if (artifactName == null) { return new DependencyAtom(namespace, name, version, composeArtifact(name, version, null, packaging), transientDep); } else { int index = artifactName.lastIndexOf("."); if (index == -1) { return new DependencyAtom(namespace, name, version, artifactName + "." + packaging, transientDep); } else { String artifactWithoutPackaging = artifactName.substring(0, index); return new DependencyAtom(namespace, name, version, artifactWithoutPackaging + "." + packaging, transientDep); } } } DependencyAtom(String namespace, String name, String version, String artifactName, boolean transientDep);  DependencyAtom(String namespace, String name, String version, String artifactName);  DependencyAtom(String namespace, String name, String version, boolean transientDep);  DependencyAtom(String namespace, String name, String version); String getPropertyName(); String getPropertyValue(); String getPropertyValueWithoutTransient(); String getResolvedPropertyValue(); String getArtifactName(); DependencyAtom with(String packaging); DependencyAtom withClassifier(String classifier); DependencyAtom withoutClassifier(); String getClassifier(); String getSyntheticPackaging(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static boolean isTransient(String atom); static String stripTransient(String atom); static DependencyAtom parse(String atom, AtomicReference<String> error); static final String DEFAULT_PACKAGING; final String namespace; final String name; final String version; final String artifactName; final boolean transientDep; }