本文整理汇总了Java中springfox.documentation.service.Parameter类的典型用法代码示例。如果您正苦于以下问题:Java Parameter类的具体用法?Java Parameter怎么用?Java Parameter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Parameter类属于springfox.documentation.service包,在下文中一共展示了Parameter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createRestApi
import springfox.documentation.service.Parameter; //导入依赖的package包/类
@Bean
public Docket createRestApi() {
ParameterBuilder tokenPar = new ParameterBuilder();
List<Parameter> parameters = new ArrayList<>();
tokenPar.name("xmall-Token")
.description("token")
.defaultValue("admin")
.modelRef(new ModelRef("string"))
.parameterType("header")
.required(false)
.build();
parameters.add(tokenPar.build());
Docket docket = new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.useDefaultResponseMessages(false)
.globalOperationParameters(parameters)
.select()
.apis(RequestHandlerSelectors.basePackage("com.jeiker.mall.controller"))
.paths(PathSelectors.any())
.build();
return docket;
}
示例2: buildGlobalOperationParametersFromSwaggerProperties
import springfox.documentation.service.Parameter; //导入依赖的package包/类
private List<Parameter> buildGlobalOperationParametersFromSwaggerProperties(
List<SwaggerProperties.GlobalOperationParameter> globalOperationParameters) {
List<Parameter> parameters = Lists.newArrayList();
if (Objects.isNull(globalOperationParameters)) {
return parameters;
}
for (SwaggerProperties.GlobalOperationParameter globalOperationParameter : globalOperationParameters) {
parameters.add(new ParameterBuilder()
.name(globalOperationParameter.getName())
.description(globalOperationParameter.getDescription())
.modelRef(new ModelRef(globalOperationParameter.getModelRef()))
.parameterType(globalOperationParameter.getParameterType())
.required(Boolean.parseBoolean(globalOperationParameter.getRequired()))
.build());
}
return parameters;
}
示例3: assemblyGlobalOperationParameters
import springfox.documentation.service.Parameter; //导入依赖的package包/类
/**
* 局部参数按照name覆盖局部参数
*
* @param globalOperationParameters
* @param docketOperationParameters
* @return
*/
private List<Parameter> assemblyGlobalOperationParameters(
List<SwaggerProperties.GlobalOperationParameter> globalOperationParameters,
List<SwaggerProperties.GlobalOperationParameter> docketOperationParameters) {
if (Objects.isNull(docketOperationParameters) || docketOperationParameters.isEmpty()) {
return buildGlobalOperationParametersFromSwaggerProperties(globalOperationParameters);
}
Set<String> docketNames = docketOperationParameters.stream()
.map(SwaggerProperties.GlobalOperationParameter::getName)
.collect(Collectors.toSet());
List<SwaggerProperties.GlobalOperationParameter> resultOperationParameters = Lists.newArrayList();
if (Objects.nonNull(globalOperationParameters)) {
for (SwaggerProperties.GlobalOperationParameter parameter : globalOperationParameters) {
if (!docketNames.contains(parameter.getName())) {
resultOperationParameters.add(parameter);
}
}
}
resultOperationParameters.addAll(docketOperationParameters);
return buildGlobalOperationParametersFromSwaggerProperties(resultOperationParameters);
}
示例4: apply
import springfox.documentation.service.Parameter; //导入依赖的package包/类
@Override
public void apply(OperationContext opCtx) {
List<Parameter> ret = new ArrayList<Parameter>();
Optional<HasCommonPathVariable> annSingle = opCtx.findControllerAnnotation(HasCommonPathVariable.class);
if (annSingle.isPresent()) {
ret.add(addParameter(annSingle.get()));
}
Optional<HasCommonPathVariables> annPlural = opCtx.findControllerAnnotation(HasCommonPathVariables.class);
if (annPlural.isPresent()) {
for (HasCommonPathVariable ann : annPlural.get().value()) {
ret.add(addParameter(ann));
}
}
opCtx.operationBuilder().parameters(ret);
}
示例5: apply
import springfox.documentation.service.Parameter; //导入依赖的package包/类
@Override
public void apply(ParameterContext context) {
ResolvedMethodParameter parameter = context.resolvedMethodParameter();
Class<?> type = parameter.getParameterType().getErasedType();
if (type != null && Pageable.class.isAssignableFrom(type)) {
Function<ResolvedType, ? extends ModelReference> factory =
createModelRefFactory(context);
ModelReference intModel = factory.apply(resolver.resolve(Integer.TYPE));
ModelReference stringModel = factory.apply(resolver.resolve(List.class, String.class));
List<Parameter> parameters = newArrayList(
context.parameterBuilder()
.parameterType("query").name("page").modelRef(intModel)
.description("Page number of the requested page")
.build(),
context.parameterBuilder()
.parameterType("query").name("size").modelRef(intModel)
.description("Size of a page")
.build(),
context.parameterBuilder()
.parameterType("query").name("sort").modelRef(stringModel).allowMultiple(true)
.description("Sorting criteria in the format: property(,asc|desc). "
+ "Default sort order is ascending. "
+ "Multiple sort criteria are supported.")
.build());
context.getOperationContext().operationBuilder().parameters(parameters);
}
}
示例6: apply
import springfox.documentation.service.Parameter; //导入依赖的package包/类
@Override
public void apply(ParameterContext context) {
MethodParameter parameter = context.methodParameter();
Class<?> type = parameter.getParameterType();
if (type != null && Pageable.class.isAssignableFrom(type)) {
Function<ResolvedType, ? extends ModelReference> factory =
createModelRefFactory(context);
ModelReference intModel = factory.apply(resolver.resolve(Integer.TYPE));
ModelReference stringModel = factory.apply(resolver.resolve(List.class, String.class));
List<Parameter> parameters = newArrayList(
context.parameterBuilder()
.parameterType("query").name("page").modelRef(intModel)
.description("Page number of the requested page")
.build(),
context.parameterBuilder()
.parameterType("query").name("size").modelRef(intModel)
.description("Size of a page")
.build(),
context.parameterBuilder()
.parameterType("query").name("sort").modelRef(stringModel).allowMultiple(true)
.description("Sorting criteria in the format: property(,asc|desc). "
+ "Default sort order is ascending. "
+ "Multiple sort criteria are supported.")
.build());
context.getOperationContext().operationBuilder().parameters(parameters);
}
}
示例7: qwPortalServicesApi
import springfox.documentation.service.Parameter; //导入依赖的package包/类
@Bean
public Docket qwPortalServicesApi() {
List<Parameter> operationParameters = Arrays.asList(
SwaggerParameters.mimeType(),
SwaggerParameters.zip()
);
return new Docket(DocumentationType.SWAGGER_2)
.protocols(new HashSet<>(Arrays.asList("https")))
.host(swaggerDisplayHost)
.pathProvider(pathProvider())
.useDefaultResponseMessages(false)
.globalOperationParameters(operationParameters)
.additionalModels(typeResolver.resolve(PostParms.class),
typeResolver.resolve(StationCountJson.class),
typeResolver.resolve(ActivityCountJson.class),
typeResolver.resolve(ActivityMetricCountJson.class),
typeResolver.resolve(ResultCountJson.class),
typeResolver.resolve(ResDetectQntLmtCountJson.class),
typeResolver.resolve(ProjectCountJson.class))
.tags(new Tag(ACTIVITY_TAG_NAME, TAG_DESCRIPTION),
new Tag(ACTIVITY_METRIC_TAG_NAME, TAG_DESCRIPTION),
new Tag(RES_DETECT_QNT_LMT_TAG_NAME, TAG_DESCRIPTION),
new Tag(RESULT_TAG_NAME, TAG_DESCRIPTION),
new Tag(SIMPLE_STATION_TAG_NAME, TAG_DESCRIPTION),
new Tag(STATION_TAG_NAME, TAG_DESCRIPTION),
new Tag(VERSION_TAG_NAME, "Display"))
;
}
示例8: activity
import springfox.documentation.service.Parameter; //导入依赖的package包/类
public static Parameter activity() {
return new ParameterBuilder()
.name("activity")
.description("Activity to filter by.")
.modelRef(new ModelRef("string"))
.parameterType("query")
.required(false)
.build();
}
示例9: analyticalmethod
import springfox.documentation.service.Parameter; //导入依赖的package包/类
public static Parameter analyticalmethod() {
return new ParameterBuilder()
.name("analyticalmethod")
.description("One or more Analytical Methods.")
.modelRef(new ModelRef("", new ModelRef("string")))
.parameterType("query")
.required(false)
.allowMultiple(true)
.build();
}
示例10: assemblage
import springfox.documentation.service.Parameter; //导入依赖的package包/类
public static Parameter assemblage() {
return new ParameterBuilder()
.name("assemblage")
.description("One or more Assemblage.")
.modelRef(new ModelRef("", new ModelRef("string")))
.parameterType("query")
.required(false)
.allowMultiple(true)
.build();
}
示例11: bBox
import springfox.documentation.service.Parameter; //导入依赖的package包/类
public static Parameter bBox() {
return new ParameterBuilder()
.name("bBox")
.description("Western-most longitude, Southern-most latitude, Eastern-most longitude, and Northern-most longitude separated by commas,"
+ "expressed in decimal degrees, WGS84, and longitudes west of Greenwich are negative. (Example: bBox=-92.8,44.2,-88.9,46.0)")
.modelRef(new ModelRef("string"))
.parameterType("query")
.required(false)
.build();
}
示例12: characteristicName
import springfox.documentation.service.Parameter; //导入依赖的package包/类
public static Parameter characteristicName() {
return new ParameterBuilder()
.name("characteristicName")
.description("One or more case-sensitive Characteristic Names.")
.modelRef(new ModelRef("", new ModelRef("string")))
.parameterType("query")
.required(false)
.allowMultiple(true)
.build();
}
示例13: characteristicType
import springfox.documentation.service.Parameter; //导入依赖的package包/类
public static Parameter characteristicType() {
return new ParameterBuilder()
.name("characteristicType")
.description("One or more case-sensitive Characteristic Types (groupings).")
.modelRef(new ModelRef("", new ModelRef("string")))
.parameterType("query")
.required(false)
.allowMultiple(true)
.build();
}
示例14: countrycode
import springfox.documentation.service.Parameter; //导入依赖的package包/类
public static Parameter countrycode() {
return new ParameterBuilder()
.name("countrycode")
.description("One or more two-character Federal Information Processing Standard (FIPS) Country Codes.")
.modelRef(new ModelRef("", new ModelRef("string")))
.parameterType("query")
.required(false)
.allowMultiple(true)
.build();
}
示例15: countycode
import springfox.documentation.service.Parameter; //导入依赖的package包/类
public static Parameter countycode() {
return new ParameterBuilder()
.name("countycode")
.description("One or more two-character Federal Information Processing Standard (FIPS) Country Code, followed by a URL-encoded colon (\"%3A\"),"
+ " followed by a two-digit FIPS State Code, followed by a URL-encoded colon (\"%3A\"), followed by a three-digit FIPS County Code")
.modelRef(new ModelRef("", new ModelRef("string")))
.parameterType("query")
.required(false)
.allowMultiple(true)
.build();
}