本文整理匯總了Java中io.swagger.annotations.ApiOperation.nickname方法的典型用法代碼示例。如果您正苦於以下問題:Java ApiOperation.nickname方法的具體用法?Java ApiOperation.nickname怎麽用?Java ApiOperation.nickname使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.swagger.annotations.ApiOperation
的用法示例。
在下文中一共展示了ApiOperation.nickname方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: retrieveVisibleMethods
import io.swagger.annotations.ApiOperation; //導入方法依賴的package包/類
private Map<String, Method> retrieveVisibleMethods(Class<?> clazz) {
Map<String, Method> visibleMethods = new HashMap<>();
for (Method method : clazz.getMethods()) {
String methodName = method.getName();
ApiOperation apiOperationAnnotation = method.getAnnotation(ApiOperation.class);
if (apiOperationAnnotation != null) {
if (apiOperationAnnotation.hidden()) {
continue;
}
if (StringUtils.isNotEmpty(apiOperationAnnotation.nickname())) {
methodName = apiOperationAnnotation.nickname();
}
}
visibleMethods.put(methodName, method);
}
return visibleMethods;
}
示例2: findSwaggerMethodName
import io.swagger.annotations.ApiOperation; //導入方法依賴的package包/類
protected String findSwaggerMethodName(Method consumerMethod) {
ApiOperation apiOperationAnnotation = consumerMethod.getAnnotation(ApiOperation.class);
if (apiOperationAnnotation == null || StringUtils.isEmpty(apiOperationAnnotation.nickname())) {
return consumerMethod.getName();
}
return apiOperationAnnotation.nickname();
}
示例3: getPath
import io.swagger.annotations.ApiOperation; //導入方法依賴的package包/類
@Override
public String getPath(ReaderContext context, Method method) {
String p = null;
Api apiAnnotation = context.getCls().getAnnotation(Api.class);
ApiOperation apiOperation = ReflectionUtils.getAnnotation(method, ApiOperation.class);
String operationPath = apiOperation == null ? null : apiOperation.nickname();
if (operationPath != null && !operationPath.isEmpty()) {
// same logic as ServletReaderExtension
p = PathUtils.collectPath(context.getParentPath(),
apiAnnotation == null ? null : apiAnnotation.value(), operationPath);
}
else {
// try JAX-RS annotations
Path parentPath = ReflectionUtils.getAnnotation(method.getDeclaringClass(), Path.class);
if (parentPath != null && parentPath.value() != null && !parentPath.value().isEmpty()) {
p = parentPath.value();
}
Path path = ReflectionUtils.getAnnotation(method, Path.class);
if (path != null && path.value() != null && !path.value().isEmpty()) {
if (p == null)
p = path.value();
else {
if (path.value().startsWith("/"))
p += path.value();
else
p = p + "/" + path.value();
}
}
}
return p;
}
示例4: getPath
import io.swagger.annotations.ApiOperation; //導入方法依賴的package包/類
@Override
public String getPath(ReaderContext context, Method method) {
final ApiOperation apiOperation = ReflectionUtils.getAnnotation(method, ApiOperation.class);
String operationId = null == apiOperation ? ""
: StringUtils.isBlank(apiOperation.nickname()) ? null : apiOperation.nickname();
return PathUtils.collectPath(context.getParentPath(), context.getInterfaceCls().getName(),
method.getName(), operationId);
}