Skip to content

Commit

Permalink
4.x: Remove unused code from ConfigAsciidocGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
Captain1653 committed Dec 21, 2024
1 parent 7da7c34 commit a484fb1
Showing 1 changed file with 8 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2017, 2021 Oracle and/or its affiliates.
* Copyright (c) 2017, 2024 Oracle and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -300,7 +300,7 @@ private static void processMethods(SortedMap<KindDesc, Map<AccessType, MethodDes
.collect(Collectors.joining(","));

AccessType accessType = AccessType.of(withDefault, optional);
MethodDesc methodDesc = new MethodDesc(kindDesc, methodName, params, accessType);
MethodDesc methodDesc = new MethodDesc(methodName, params);

Map<AccessType, MethodDesc> typeMethods = methods.computeIfAbsent(kindDesc, (tn) -> new HashMap<>());
if (typeMethods.containsKey(accessType)) {
Expand All @@ -321,12 +321,6 @@ private static String formatParams(String text) {
;
}

private static String methodToString(Method method) {
StringBuilder sb = new StringBuilder(method.getName());
sb.append(" (").append(Arrays.toString(method.getParameters())).append(" ) : " + method.getGenericReturnType());
return sb.toString();
}

private static class KindDesc implements Comparable<KindDesc> {
private boolean generic;
private String methodSuffix;
Expand Down Expand Up @@ -389,27 +383,19 @@ public boolean accept(Method method) {
}
if (firstParamClass != null && method.getParameterCount() > 0) {
Class<?> currentFirstParameterClass = method.getParameters()[0].getType();
if (firstParamClass.isAssignableFrom(currentFirstParameterClass)) {
return true;
} else {
//System.out.println("Not acceptable class: " + currentFirstParameterClass);
}
return firstParamClass.isAssignableFrom(currentFirstParameterClass);
}
return false;
}
}

private static class MethodDesc {
private KindDesc kind;
private String name;
private String params;
private AccessType accessType;

public MethodDesc(KindDesc kind, String name, String params, AccessType accessType) {
this.kind = kind;
public MethodDesc(String name, String params) {
this.name = name;
this.params = params;
this.accessType = accessType;
}

public String format() {
Expand All @@ -425,18 +411,14 @@ public String format() {
}

private enum AccessType {
COMMON("Common", false, false),
WITH_DEFAULT("With Default", true, false),
OPTIONAL("Optional", false, true);
COMMON("Common"),
WITH_DEFAULT("With Default"),
OPTIONAL("Optional");

private String desc;
private boolean withDefault;
private boolean optional;

AccessType(String desc, boolean withDefault, boolean optional) {
AccessType(String desc) {
this.desc = desc;
this.withDefault = withDefault;
this.optional = optional;
}

public static AccessType of(boolean withDefault, boolean optional) {
Expand Down

0 comments on commit a484fb1

Please sign in to comment.