
net.java.trueupdate.jax.rs.client.ArtifactDescriptors Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of trueupdate-jax-rs-client Show documentation
Show all versions of trueupdate-jax-rs-client Show documentation
Provides a RESTful web service client for artifact updates.
The newest version!
/*
* Copyright (C) 2013 Stimulus Software & Schlichtherle IT Services.
* All rights reserved. Use is subject to license terms.
*/
package net.java.trueupdate.jax.rs.client;
import com.sun.jersey.core.util.MultivaluedMapImpl;
import java.util.concurrent.Callable;
import javax.ws.rs.core.MultivaluedMap;
import net.java.trueupdate.artifact.spec.ArtifactDescriptor;
/**
* Utility functions for {@link ArtifactDescriptor}s.
*
* @author Christian Schlichtherle
*/
final class ArtifactDescriptors {
private ArtifactDescriptors() { }
/**
* Returns a new multi valued map with query parameters for the given
* artifact descriptor.
*
* @param descriptor the artifact descriptor.
* @return the new multi valued map with the query parameters.
*/
static MultivaluedMap queryParameters(
final ArtifactDescriptor descriptor) {
class QueryParameters implements Callable> {
final MultivaluedMap map = new MultivaluedMapImpl();
@SuppressWarnings("ReturnOfCollectionOrArrayField")
@Override public MultivaluedMap call() {
put("groupId", descriptor.groupId());
put("artifactId", descriptor.artifactId());
put("version", descriptor.version());
put("classifier", descriptor.classifier());
put("extension", descriptor.extension());
return map;
}
void put(String key, String value) {
if (!value.isEmpty()) map.putSingle(key, value);
}
} // QueryParameters
return new QueryParameters().call();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy