优化缩进

v1.4.1
hiparker 4 years ago
parent 652f61488a
commit 4e2965ceda

@ -38,31 +38,30 @@ import static com.google.common.collect.Maps.newHashMap;
@Aspect
public class UserCachingOperationNameGenerator {
private final Map<String, Integer> generated = Maps.newHashMap();
private final Map<String, Integer> generated = Maps.newHashMap();
@Pointcut("execution(* springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator.startingWith(String))")
public void c() {
}
@Pointcut("execution(* springfox.documentation.spring.web.readers.operation.CachingOperationNameGenerator.startingWith(String))")
public void c() {
}
@Around("c()")
public Object a(ProceedingJoinPoint point) {
Object[] args = point.getArgs();
return startingWith(String.valueOf(args[0]));
}
@Around("c()")
public Object a(ProceedingJoinPoint point) {
Object[] args = point.getArgs();
return startingWith(String.valueOf(args[0]));
}
private String startingWith(String prefix) {
if (generated.containsKey(prefix)) {
generated.put(prefix, generated.get(prefix) + 1);
//log.warn("组件中存在相同的方法名称,自动生成组件方法唯一名称进行替换: {}", nextUniqueOperationName);
return String.format("%s_%s", prefix, generated.get(prefix));
} else {
generated.put(prefix, 0);
return prefix;
private String startingWith(String prefix) {
if (generated.containsKey(prefix)) {
generated.put(prefix, generated.get(prefix) + 1);
//log.warn("组件中存在相同的方法名称,自动生成组件方法唯一名称进行替换: {}", nextUniqueOperationName);
return String.format("%s_%s", prefix, generated.get(prefix));
} else {
generated.put(prefix, 0);
return prefix;
}
}
}
}

Loading…
Cancel
Save