Skip to content

Commit 6fbb075

Browse files
committed
docs(plugin): better doc helper documentation
1 parent c6d19c1 commit 6fbb075

File tree

6 files changed

+34
-36
lines changed

6 files changed

+34
-36
lines changed

fj-doc-maven-plugin/src/main/resources/config/template/flavour/flavour-macro.ftl

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,32 @@
8181
<@createPathMethod context=context outputMime=outputMime outputExtension=outputExtension outputDescription=outputDescription/>
8282
</#macro>
8383

84-
<#macro createSpringBootPath context outputMime outputExtension outputDescription><@createSpringBootPathPrefix context=context outputMime=outputMime outputExtension=outputExtension outputDescription=outputDescription pathPrefix=''/></#macro>
84+
<#macro createSpringBootPath context outputMime outputExtension outputDescription><@createSpringBootPathPrefix context=context outputMime=outputMime outputExtension=outputExtension outputDescription=outputDescription pathPrefix=''/></#macro>
85+
86+
<#macro docProcessConfigDocHelperComment context>
87+
/*
88+
* FreemarkerDocProcessConfig is thread-safe and should be initialized once for each config file.
89+
*
90+
* Consider using a @ApplicationScoped or Singleton approach.
91+
*/
92+
</#macro>
93+
94+
<#macro getDocProcessConfigDocHelperComment context>
95+
/**
96+
* Accessor for FreemarkerDocProcessConfig configuration.
97+
*
98+
* @return the FreemarkerDocProcessConfig instance associated with this helper.
99+
*/
100+
</#macro>
101+
102+
<#macro docHelperBody context>
103+
public class DocHelper {
104+
105+
<@docProcessConfigDocHelperComment context=context/>
106+
private FreemarkerDocProcessConfig docProcessConfig = FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://${context.resourcePathFmConfigXml}" );
107+
108+
<@getDocProcessConfigDocHelperComment context=context/>
109+
public FreemarkerDocProcessConfig getDocProcessConfig() { return this.docProcessConfig; }
110+
111+
}
112+
</#macro>

fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-3-gradle-kts/DocHelper.ftl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,4 @@ import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigFacade;
66
import jakarta.enterprise.context.ApplicationScoped;
77

88
@ApplicationScoped
9-
public class DocHelper {
10-
11-
private FreemarkerDocProcessConfig docProcessConfig = FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://${context.resourcePathFmConfigXml}" );
12-
13-
public FreemarkerDocProcessConfig getDocProcessConfig() { return this.docProcessConfig; }
14-
15-
}
9+
<@fhm.docHelperBody context=context/>

fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-3-gradle/DocHelper.ftl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,4 @@ import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigFacade;
66
import jakarta.enterprise.context.ApplicationScoped;
77

88
@ApplicationScoped
9-
public class DocHelper {
10-
11-
private FreemarkerDocProcessConfig docProcessConfig = FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://${context.resourcePathFmConfigXml}" );
12-
13-
public FreemarkerDocProcessConfig getDocProcessConfig() { return this.docProcessConfig; }
14-
15-
}
9+
<@fhm.docHelperBody context=context/>

fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-3-properties/DocHelper.ftl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,4 @@ import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigFacade;
66
import jakarta.enterprise.context.ApplicationScoped;
77

88
@ApplicationScoped
9-
public class DocHelper {
10-
11-
private FreemarkerDocProcessConfig docProcessConfig = FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://${context.resourcePathFmConfigXml}" );
12-
13-
public FreemarkerDocProcessConfig getDocProcessConfig() { return this.docProcessConfig; }
14-
15-
}
9+
<@fhm.docHelperBody context=context/>

fj-doc-maven-plugin/src/main/resources/config/template/flavour/quarkus-3/DocHelper.ftl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,4 @@ import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigFacade;
66
import jakarta.enterprise.context.ApplicationScoped;
77

88
@ApplicationScoped
9-
public class DocHelper {
10-
11-
private FreemarkerDocProcessConfig docProcessConfig = FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://${context.resourcePathFmConfigXml}" );
12-
13-
public FreemarkerDocProcessConfig getDocProcessConfig() { return this.docProcessConfig; }
14-
15-
}
9+
<@fhm.docHelperBody context=context/>

fj-doc-maven-plugin/src/main/resources/config/template/flavour/springboot-3/DocHelper.ftl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,4 @@ import org.fugerit.java.doc.freemarker.process.FreemarkerDocProcessConfigFacade;
66
import org.springframework.stereotype.Component;
77

88
@Component
9-
public class DocHelper {
10-
11-
private FreemarkerDocProcessConfig docProcessConfig = FreemarkerDocProcessConfigFacade.loadConfigSafe( "cl://${context.resourcePathFmConfigXml}" );
12-
13-
public FreemarkerDocProcessConfig getDocProcessConfig() { return this.docProcessConfig; }
14-
15-
}
9+
<@fhm.docHelperBody context=context/>

0 commit comments

Comments
 (0)