本文整理汇总了Java中io.swagger.models.parameters.Parameter.getName方法的典型用法代码示例。如果您正苦于以下问题:Java Parameter.getName方法的具体用法?Java Parameter.getName怎么用?Java Parameter.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类io.swagger.models.parameters.Parameter
的用法示例。
在下文中一共展示了Parameter.getName方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateQueryParameter
import io.swagger.models.parameters.Parameter; //导入方法依赖的package包/类
private Status validateQueryParameter(final HttpServerExchange exchange,
final SwaggerOperation swaggerOperation,
final Parameter queryParameter) {
final Collection<String> queryParameterValues = exchange.getQueryParameters().get(queryParameter.getName());
if ((queryParameterValues == null || queryParameterValues.isEmpty())) {
if(queryParameter.getRequired()) {
return new Status(VALIDATOR_REQUEST_PARAMETER_QUERY_MISSING, queryParameter.getName(), swaggerOperation.getPathString().original());
}
} else {
Optional<Status> optional = queryParameterValues
.stream()
.map((v) -> parameterValidators.validate(v, queryParameter))
.filter(s -> s != null)
.findFirst();
if(optional.isPresent()) {
return optional.get();
}
}
return null;
}
示例2: validateHeader
import io.swagger.models.parameters.Parameter; //导入方法依赖的package包/类
private Status validateHeader(final HttpServerExchange exchange,
final SwaggerOperation swaggerOperation,
final Parameter headerParameter) {
final HeaderValues headerValues = exchange.getRequestHeaders().get(headerParameter.getName());
if ((headerValues == null || headerValues.isEmpty())) {
if(headerParameter.getRequired()) {
return new Status(VALIDATOR_REQUEST_PARAMETER_HEADER_MISSING, headerParameter.getName(), swaggerOperation.getPathString().original());
}
} else {
Optional<Status> optional = headerValues
.stream()
.map((v) -> parameterValidators.validate(v, headerParameter))
.filter(s -> s != null)
.findFirst();
if(optional.isPresent()) {
return optional.get();
}
}
return null;
}
示例3: validate
import io.swagger.models.parameters.Parameter; //导入方法依赖的package包/类
public Status validate(final Collection<String> values, final Parameter p) {
if (p == null) {
return null;
}
final SerializableParameter parameter = (SerializableParameter)p;
if (parameter.getRequired() && (values == null || values.isEmpty())) {
return new Status("ERR11001", parameter.getName());
}
if (values == null) {
return null;
}
if (!parameter.getCollectionFormat().equalsIgnoreCase(CollectionFormat.MULTI.name())) {
return new Status("ERR11005", p.getName(), parameter.getCollectionFormat(), "multi");
}
return doValidate(values, parameter);
}
示例4: validate
import io.swagger.models.parameters.Parameter; //导入方法依赖的package包/类
@Override
public Status validate(final String value, final Parameter p) {
if (!supports(p)) {
return null;
}
final SerializableParameter parameter = (SerializableParameter)p;
if (parameter.getRequired() && (value == null || value.trim().isEmpty())) {
return new Status("ERR11001", p.getName());
}
if (value == null || value.trim().isEmpty()) {
return null;
}
if (!matchesEnumIfDefined(value, parameter)) {
return new Status("ERR11002", value, parameter.getName(), parameter.getEnum());
}
return doValidate(value, parameter);
}
示例5: replaceBodyBasedParameter
import io.swagger.models.parameters.Parameter; //导入方法依赖的package包/类
protected void replaceBodyBasedParameter(OperationGenerator operationGenerator, Parameter bodyBasedParameter) {
if (ParamUtils.isRealBodyParameter(bodyBasedParameter)) {
return;
}
List<Parameter> swaggerParameters = operationGenerator.getSwaggerParameters();
int idx = swaggerParameters.indexOf(bodyBasedParameter);
String bodyParamName = bodyBasedParameter.getName();
BodyParameter bodyParameter = ((PendingBodyParameter) bodyBasedParameter).createBodyParameter(bodyParamName);
swaggerParameters.set(idx, bodyParameter);
}
示例6: createInterface
import io.swagger.models.parameters.Parameter; //导入方法依赖的package包/类
private static Class<?> createInterface(Swagger swagger, ClassLoader classLoader, String packageName,
String intfName) {
ClassConfig classConfig = new ClassConfig();
classConfig.setClassName(intfName);
classConfig.setIntf(true);
for (Path path : swagger.getPaths().values()) {
for (Operation operation : path.getOperations()) {
// 参数可能重名,所以packageName必须跟operation相关才能隔离
String opPackageName = packageName + "." + operation.getOperationId();
Response result = operation.getResponses().get(SwaggerConst.SUCCESS_KEY);
JavaType resultJavaType = ConverterMgr.findJavaType(classLoader,
opPackageName,
swagger,
result.getSchema());
MethodConfig methodConfig = new MethodConfig();
methodConfig.setName(operation.getOperationId());
methodConfig.setResult(resultJavaType);
for (Parameter parameter : operation.getParameters()) {
String paramName = parameter.getName();
paramName = correctMethodParameterName(paramName);
JavaType paramJavaType = ConverterMgr.findJavaType(classLoader,
opPackageName,
swagger,
parameter);
methodConfig.addParameter(paramName, paramJavaType);
}
classConfig.addMethod(methodConfig);
}
}
return JavassistUtils.createClass(classLoader, classConfig);
}
示例7: create
import io.swagger.models.parameters.Parameter; //导入方法依赖的package包/类
@Override
public ParamValueProcessor create(Parameter parameter, Type genericParamType) {
JavaType targetType = TypeFactory.defaultInstance().constructType(genericParamType);
if (isPart(parameter)) {
return new PartProcessor(parameter.getName(), targetType);
}
return new FormProcessor(parameter.getName(), targetType);
}
示例8: RestParam
import io.swagger.models.parameters.Parameter; //导入方法依赖的package包/类
public RestParam(int paramIndex, Parameter parameter, Type genericParamType) {
this.paramIndex = paramIndex;
this.paramName = parameter.getName();
init(parameter, genericParamType);
}
示例9: create
import io.swagger.models.parameters.Parameter; //导入方法依赖的package包/类
@Override
public ParamValueProcessor create(Parameter parameter, Type genericParamType) {
JavaType targetType = TypeFactory.defaultInstance().constructType(genericParamType);
return new QueryProcessor(parameter.getName(), targetType);
}
示例10: create
import io.swagger.models.parameters.Parameter; //导入方法依赖的package包/类
@Override
public ParamValueProcessor create(Parameter parameter, Type genericParamType) {
JavaType targetType = TypeFactory.defaultInstance().constructType(genericParamType);
return new CookieProcessor(parameter.getName(), targetType);
}
示例11: create
import io.swagger.models.parameters.Parameter; //导入方法依赖的package包/类
@Override
public ParamValueProcessor create(Parameter parameter, Type genericParamType) {
JavaType targetType = TypeFactory.defaultInstance().constructType(genericParamType);
return new PathProcessor(parameter.getName(), targetType);
}
示例12: create
import io.swagger.models.parameters.Parameter; //导入方法依赖的package包/类
@Override
public ParamValueProcessor create(Parameter parameter, Type genericParamType) {
JavaType targetType = TypeFactory.defaultInstance().constructType(genericParamType);
return new HeaderProcessor(parameter.getName(), targetType);
}