
net.cpollet.maven.plugins.postman.backend.adapters.ParameterAdapter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of postman-maven-plugin Show documentation
Show all versions of postman-maven-plugin Show documentation
A maven plugin to export JAX-RS annotated classes and methods to Postman collection
The newest version!
package net.cpollet.maven.plugins.postman.backend.adapters;
import lombok.AllArgsConstructor;
import javax.ws.rs.PathParam;
import javax.ws.rs.QueryParam;
import java.lang.reflect.Parameter;
import java.util.Optional;
@AllArgsConstructor
public class ParameterAdapter {
private final Parameter parameter;
public Optional getQueryParamName() {
if (isHttpQueryParameter()) {
return Optional.of(parameter.getAnnotation(QueryParam.class).value());
}
return Optional.empty();
}
public boolean isHttpQueryParameter() {
return parameter.isAnnotationPresent(QueryParam.class);
}
public boolean isHttpBodyParameter() {
return !isHttpQueryParameter() && !isHttpPathParameter();
}
private boolean isHttpPathParameter() {
return parameter.isAnnotationPresent(PathParam.class);
}
public Class getType() {
return parameter.getType();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy