Skip to content
This repository was archived by the owner on Dec 4, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 33 additions & 1 deletion src/main/java/com/ly/doc/template/IJavadocDocTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,13 @@ default List<T> buildServiceMethod(final JavaClass cls, ApiConfig apiConfig,
if (Objects.nonNull(method.getTagByName(IGNORE))) {
continue;
}

// skip method
boolean skipMethod = this.skipMethod(cls, method, apiConfig, projectBuilder);
if (skipMethod) {
continue;
}

if (StringUtil.isEmpty(method.getComment()) && apiConfig.isStrict()) {
throw new RuntimeException(
"Unable to find comment for method " + method.getName() + " in " + cls.getCanonicalName());
Expand Down Expand Up @@ -394,7 +401,7 @@ default List<T> buildServiceMethod(final JavaClass cls, ApiConfig apiConfig,
Function.identity(), this::mergeJavadocMethods, LinkedHashMap::new));

int methodOrder = 0;
List<T> javadocJavaMethods = new ArrayList<>(methodMap.values().size());
List<T> javadocJavaMethods = new ArrayList<>(methodMap.size());
for (T method : methodMap.values()) {
methodOrder++;
method.setOrder(methodOrder);
Expand Down Expand Up @@ -443,4 +450,29 @@ default T mergeJavadocMethods(T existing, T replacement) {
return existing;
}

/**
* Determines whether the specified method should be skipped during documentation
* generation.
* <p>
* If this method returns {@code true}, the method will be excluded from the generated
* documentation. If it returns {@code false}, the method will be included.
* </p>
* <p>
* The default implementation always returns {@code false}, meaning no methods are
* skipped by default. Subclasses may override this method to provide custom logic for
* excluding certain methods.
* </p>
* @param cls The Java class containing the method.
* @param method The Java method to check.
* @param apiConfig The API configuration object, used to control documentation
* behavior.
* @param projectBuilder The project documentation configuration builder.
* @return {@code true} if the method should be skipped (not documented),
* {@code false} if it should be included.
*/
default boolean skipMethod(final JavaClass cls, final JavaMethod method, ApiConfig apiConfig,
ProjectDocConfigBuilder projectBuilder) {
return false;
}

}