Skip to content

Commit c50ff1e

Browse files
committed
Minor renaming, refactoring
1 parent d5cd57f commit c50ff1e

6 files changed

Lines changed: 15 additions & 14 deletions

File tree

src/main/java/tools/jackson/dataformat/xml/ser/DTD.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
public record DTD(String rootName,
1616
String systemId, String publicId,
1717
String internalSubset)
18-
implements XmlPrologDirective
18+
implements PrologDirective
1919
{
2020
public DTD {
2121
rootName = ArgUtil.nonEmptyNonNull("rootName", rootName);

src/main/java/tools/jackson/dataformat/xml/ser/Comment.java renamed to src/main/java/tools/jackson/dataformat/xml/ser/PrologComment.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77
import tools.jackson.dataformat.xml.util.ArgUtil;
88

99
/**
10-
* Value container to represent XML Comment within "prolog"
10+
* Value container to represent XML Comment within Prolog
1111
* part of the Document (before XML Root element, after XML
1212
* declaration if one written),
1313
* to be written using {@link XmlGeneratorInitializer}.
1414
*
1515
* @since 3.2
1616
*/
17-
public record Comment(String content)
18-
implements XmlPrologDirective
17+
public record PrologComment(String content)
18+
implements PrologDirective
1919
{
20-
public Comment {
20+
public PrologComment {
2121
content = ArgUtil.nullToEmpty(content);
2222
}
2323

src/main/java/tools/jackson/dataformat/xml/ser/XmlPrologDirective.java renamed to src/main/java/tools/jackson/dataformat/xml/ser/PrologDirective.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66

77
/**
88
* Common API for XML nodes -- Comments, DTDs, Processing Instructions -- to
9-
* be written <b>before</b> actual XML Document (root node).
9+
* be written in Document Prolog (before actual XML Document (root node),
10+
* after optional XML Declaration).
1011
*
1112
* @since 3.2
1213
*/
13-
public interface XmlPrologDirective
14+
public interface PrologDirective
1415
{
1516
/**
1617
* Method to call to actually write out the directive using given

src/main/java/tools/jackson/dataformat/xml/ser/ToXmlGenerator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public class ToXmlGenerator
104104
*
105105
* @since 3.2
106106
*/
107-
protected List<XmlPrologDirective> _prologDirectives;
107+
protected List<PrologDirective> _prologDirectives;
108108

109109
/**
110110
* Whether linefeed ("pretty-printing") enabled between directives
@@ -233,7 +233,7 @@ public ToXmlGenerator(ObjectWriteContext writeCtxt, IOContext ioCtxt,
233233
* @since 3.2
234234
*/
235235
public void initProlog(boolean lfBetweenPrologDirectives,
236-
List<XmlPrologDirective> directives)
236+
List<PrologDirective> directives)
237237
{
238238
if (_initialized) { // sanity check
239239
_reportError("Internal error: cannot call `initConfig()` after generator already initialized");
@@ -277,7 +277,7 @@ public void initGenerator() throws JacksonException
277277

278278
// 19-Apr-2026, tatu: [dataformat-xml#150] Allow outputting DTD
279279
if (_prologDirectives != null) {
280-
for (XmlPrologDirective d : _prologDirectives) {
280+
for (PrologDirective d : _prologDirectives) {
281281
d.write(this, _xmlWriter);
282282
// Add linefeed separators b/w directives
283283
if (_lfBetweenPrologDirectives) {

src/main/java/tools/jackson/dataformat/xml/ser/XmlGeneratorInitializer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
public class XmlGeneratorInitializer
3030
implements GeneratorInitializer
3131
{
32-
protected List<XmlPrologDirective> _directives;
32+
protected List<PrologDirective> _directives;
3333

3434
protected boolean _addLfBetweenPrologDirectives = true;
3535

@@ -66,7 +66,7 @@ public XmlGeneratorInitializer linefeedsBetweenPrologDirectives(boolean addLFs)
6666
* @return This initializer for call chaining
6767
*/
6868
public XmlGeneratorInitializer addComment(String commentContent) {
69-
return _add(new Comment(commentContent));
69+
return _add(new PrologComment(commentContent));
7070
}
7171

7272
/**
@@ -105,7 +105,7 @@ public XmlGeneratorInitializer addDTD(DTD dtd) {
105105
return _add(dtd);
106106
}
107107

108-
protected XmlGeneratorInitializer _add(XmlPrologDirective d) {
108+
protected XmlGeneratorInitializer _add(PrologDirective d) {
109109
if (_directives == null) {
110110
_directives = new ArrayList<>();
111111
}

src/test/java/tools/jackson/dataformat/xml/ser/XmlGeneratorInitializerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public void testEmptyComment() throws Exception
179179
w.writeValueAsString(new StringBean("test")));
180180
}
181181

182-
// Null content is coerced to empty by Comment(String) constructor
182+
// Null content is coerced to empty by PrologComment(String) constructor
183183
@Test
184184
public void testNullComment() throws Exception
185185
{

0 commit comments

Comments
 (0)