com.networknt.openapi.parameter.QueryParameterStyle Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openapi-meta Show documentation
Show all versions of openapi-meta Show documentation
An OpenAPI Specification 3.0 meta handler module that cache the spec and attached context related operation to the request based on uri and method.
package com.networknt.openapi.parameter;
import java.util.HashMap;
import java.util.Map;
import com.networknt.utility.StringUtils;
public enum QueryParameterStyle {
FORM(new FormStyleDeserializer()),
SPACEDELIMITED(new SpaceDelimitedStyleDeserializer()),
PIPEDELIMITED(new PipeDelimitedStyleDeserializer()),
DEEPOBJECT(new DeepObjectStyleDeserializer());
private static Map lookup = new HashMap<>();
private final StyleParameterDeserializer deserializer;
private QueryParameterStyle(StyleParameterDeserializer deserializer) {
this.deserializer = deserializer;
}
static {
for (QueryParameterStyle style: QueryParameterStyle.values()) {
lookup.put(style.name(), style);
}
}
public static QueryParameterStyle of(String styleStr) {
if (StringUtils.isBlank(styleStr)) {
return FORM;
}
return lookup.get(StringUtils.trimToEmpty(styleStr).toUpperCase());
}
public static boolean is(String styleStr, QueryParameterStyle style) {
return style == of(styleStr);
}
public StyleParameterDeserializer getDeserializer() {
return this.deserializer;
}
}