Skip to content

Commit d5fa60e

Browse files
committed
feat: extend doc context visibility to handler #545
1 parent a08debf commit d5fa60e

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

fj-doc-base/src/main/java/org/fugerit/java/doc/base/config/DocInput.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import org.fugerit.java.doc.base.model.DocBase;
77

88
import lombok.Getter;
9+
import org.fugerit.java.doc.base.process.DocProcessContext;
910

1011
public class DocInput {
1112

@@ -15,6 +16,8 @@ public class DocInput {
1516

1617
@Getter private int source;
1718

19+
@Getter private DocProcessContext context;
20+
1821
private DocBase doc;
1922

2023
public DocBase getDoc() {
@@ -30,11 +33,16 @@ public DocInput(String type, DocBase doc, Reader reader) {
3033
}
3134

3235
public DocInput(String type, DocBase doc, Reader reader, int source) {
36+
this(type, doc, reader, source, null);
37+
}
38+
39+
public DocInput(String type, DocBase doc, Reader reader, int source, DocProcessContext context) {
3340
super();
3441
this.type = type;
3542
this.reader = reader;
3643
this.doc = doc;
3744
this.source = source;
45+
this.context = context;
3846
}
3947

4048
public static DocInput newInput( String type, DocBase doc ) {
@@ -57,5 +65,12 @@ public static DocInput newInput( String type, DocBase doc, Reader reader, int so
5765
return new DocInput( type, doc, reader, source );
5866
}
5967

60-
68+
public static DocInput newInput( String type, Reader reader, int source, DocProcessContext context ) {
69+
return newInput( type, null, reader, source, context );
70+
}
71+
72+
public static DocInput newInput( String type, DocBase doc, Reader reader, int source, DocProcessContext context ) {
73+
return new DocInput( type, doc, reader, source, context );
74+
}
75+
6176
}

fj-doc-base/src/main/resources/META-INF/native-image/org.fugerit.java/fj-doc-base/reflect-config.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2412,12 +2412,18 @@
24122412
}, {
24132413
"name" : "<init>",
24142414
"parameterTypes" : [ "java.lang.String", "org.fugerit.java.doc.base.model.DocBase", "java.io.Reader", "int" ]
2415+
}, {
2416+
"name" : "<init>",
2417+
"parameterTypes" : [ "java.lang.String", "org.fugerit.java.doc.base.model.DocBase", "java.io.Reader", "int", "org.fugerit.java.doc.base.process.DocProcessContext" ]
24152418
}, {
24162419
"name" : "equals",
24172420
"parameterTypes" : [ "java.lang.Object" ]
24182421
}, {
24192422
"name" : "getClass",
24202423
"parameterTypes" : [ ]
2424+
}, {
2425+
"name" : "getContext",
2426+
"parameterTypes" : [ ]
24212427
}, {
24222428
"name" : "getDoc",
24232429
"parameterTypes" : [ ]
@@ -2439,6 +2445,9 @@
24392445
}, {
24402446
"name" : "newInput",
24412447
"parameterTypes" : [ "java.lang.String", "java.io.Reader", "int" ]
2448+
}, {
2449+
"name" : "newInput",
2450+
"parameterTypes" : [ "java.lang.String", "java.io.Reader", "int", "org.fugerit.java.doc.base.process.DocProcessContext" ]
24422451
}, {
24432452
"name" : "newInput",
24442453
"parameterTypes" : [ "java.lang.String", "org.fugerit.java.doc.base.model.DocBase" ]
@@ -2448,6 +2457,9 @@
24482457
}, {
24492458
"name" : "newInput",
24502459
"parameterTypes" : [ "java.lang.String", "org.fugerit.java.doc.base.model.DocBase", "java.io.Reader", "int" ]
2460+
}, {
2461+
"name" : "newInput",
2462+
"parameterTypes" : [ "java.lang.String", "org.fugerit.java.doc.base.model.DocBase", "java.io.Reader", "int", "org.fugerit.java.doc.base.process.DocProcessContext" ]
24512463
}, {
24522464
"name" : "notify",
24532465
"parameterTypes" : [ ]

fj-doc-freemarker/src/main/java/org/fugerit/java/doc/freemarker/process/FreemarkerDocProcessConfig.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public DocProcessData fullProcess( String chainId, DocProcessContext context, Do
113113
log.debug( "overrideSourceType {}, for chainId : {}", overrideSourceType, chainId );
114114
context.withSourceType( overrideSourceType );
115115
}
116-
DocInput docInput = this.docInputProcess.process( DocInput.newInput( handler.getType() , data.getCurrentXmlReader(), context.getSourceType() ) );
116+
DocInput docInput = this.docInputProcess.process( DocInput.newInput( handler.getType() , data.getCurrentXmlReader(), context.getSourceType(), context ) );
117117
handler.handle( docInput , docOutput );
118118
return data;
119119
}

0 commit comments

Comments
 (0)