Added closeable interface on content writers

This commit is contained in:
Willem Cazander 2025-01-19 18:57:19 +01:00
parent d77f9dfc57
commit 13171b39ab
7 changed files with 118 additions and 150 deletions

View file

@ -27,6 +27,7 @@
package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf5; package love.distributedrebirth.nx01.warp.manifestor.scopic.iomf5;
import java.io.IOException;
import java.util.Objects; import java.util.Objects;
import org.x4o.o2o.io.sax3.ContentWriterAdapter; import org.x4o.o2o.io.sax3.ContentWriterAdapter;
@ -52,6 +53,10 @@ public class ScopicManifest5ContentParser extends ContentWriterAdapter {
this.handler = Objects.requireNonNull(handler); this.handler = Objects.requireNonNull(handler);
} }
@Override
public void close() throws IOException {
}
@Override @Override
public void startDocument() throws SAXException { public void startDocument() throws SAXException {
handler.strobeManifestStart(); handler.strobeManifestStart();

View file

@ -23,6 +23,7 @@
package org.x4o.o2o.io.sax3; package org.x4o.o2o.io.sax3;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.Closeable;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -35,6 +36,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.PrimitiveIterator; import java.util.PrimitiveIterator;
import java.util.Set; import java.util.Set;
import java.util.Stack; import java.util.Stack;
@ -52,10 +54,10 @@ import org.xml.sax.SAXException;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 May 3, 2013 * @version 1.0 May 3, 2013
*/ */
public class AbstractContentWriterHandler implements ContentHandler { public class AbstractContentWriterHandler implements ContentHandler, Closeable {
private final PropertyConfig propertyConfig; private final PropertyConfig propertyConfig;
private Writer out = null; private final Writer out;
private int indent = 0; private int indent = 0;
private Map<String,String> prefixMapping = null; private Map<String,String> prefixMapping = null;
private List<String> printedMappings = null; private List<String> printedMappings = null;
@ -109,37 +111,22 @@ public class AbstractContentWriterHandler implements ContentHandler {
* @param out The writer to print the xml to. * @param out The writer to print the xml to.
*/ */
public AbstractContentWriterHandler(Writer out) { public AbstractContentWriterHandler(Writer out) {
if (out==null) { this.out = Objects.requireNonNull(out, "Can't write on null writer.");
throw new NullPointerException("Can't write on null writer."); this.prefixMapping = new HashMap<String,String>(15);
} this.printedMappings = new ArrayList<String>(15);
this.out = out; this.elements = new Stack<String>();
prefixMapping = new HashMap<String,String>(15); this.propertyConfig = new PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
printedMappings = new ArrayList<String>(15);
elements = new Stack<String>();
propertyConfig = new PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
} }
public PropertyConfig getPropertyConfig() { public PropertyConfig getPropertyConfig() {
return propertyConfig; return propertyConfig;
} }
@Deprecated @Override
public void closeWriter() throws IOException { public void close() throws IOException {
if (out==null) {
return;
}
out.close(); out.close();
} }
@Deprecated
public void closeWriterSafe() {
try {
closeWriter();
} catch (IOException e) {
e.getMessage(); // discard exception
}
}
/** /**
* @see org.xml.sax.ContentHandler#startDocument() * @see org.xml.sax.ContentHandler#startDocument()
*/ */

View file

@ -22,6 +22,8 @@
*/ */
package org.x4o.o2o.io.sax3; package org.x4o.o2o.io.sax3;
import java.io.Closeable;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import org.xml.sax.ContentHandler; import org.xml.sax.ContentHandler;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
@ -34,7 +36,7 @@ import org.xml.sax.ext.LexicalHandler;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Apr 30, 2013 * @version 1.0 Apr 30, 2013
*/ */
public interface ContentWriter extends ContentHandler,LexicalHandler { public interface ContentWriter extends ContentHandler, LexicalHandler, Closeable {
/** /**
* Starts and ends an element in one call. * Starts and ends an element in one call.

View file

@ -22,7 +22,9 @@
*/ */
package org.x4o.o2o.io.sax3; package org.x4o.o2o.io.sax3;
import java.io.Closeable;
import java.io.IOException; import java.io.IOException;
import java.util.Objects;
import org.xml.sax.Attributes; import org.xml.sax.Attributes;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
@ -34,7 +36,7 @@ import org.xml.sax.helpers.AttributesImpl;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 May 3, 2013 * @version 1.0 May 3, 2013
*/ */
public class ContentWriterTagWrapper<TAG extends Enum<?>,TAG_WRITER extends ContentWriter> implements ContentWriterTag<TAG> { public class ContentWriterTagWrapper<TAG extends Enum<?>,TAG_WRITER extends ContentWriter> implements ContentWriterTag<TAG>, Closeable {
private final Attributes EMPTY_ATTRIBUTES = new AttributesImpl(); private final Attributes EMPTY_ATTRIBUTES = new AttributesImpl();
private final TAG_WRITER contentWriter; private final TAG_WRITER contentWriter;
@ -46,18 +48,14 @@ public class ContentWriterTagWrapper<TAG extends Enum<?>,TAG_WRITER extends Cont
} }
public ContentWriterTagWrapper(TAG_WRITER contentWriter, String tagNamespaceUri, String tagNamespacePrefix) { public ContentWriterTagWrapper(TAG_WRITER contentWriter, String tagNamespaceUri, String tagNamespacePrefix) {
if (contentWriter == null) { this.contentWriter = Objects.requireNonNull(contentWriter, "Can't create wrapper on null ContentWriter");
throw new NullPointerException("Can't create wrapper on null ContentWriter"); this.tagNamespaceUri = Objects.requireNonNull(tagNamespaceUri, "Can't create wrapper with null tagNamespaceUri");
} this.tagNamespacePrefix = Objects.requireNonNull(tagNamespacePrefix, "Can't create wrapper with null tagNamespacePrefix");
if (tagNamespaceUri == null) { }
throw new NullPointerException("Can't create wrapper with null tagNamespaceUri");
} @Override
if (tagNamespacePrefix == null) { public void close() throws IOException {
throw new NullPointerException("Can't create wrapper with null tagNamespacePrefix"); contentWriter.close();
}
this.contentWriter=contentWriter;
this.tagNamespaceUri=tagNamespaceUri;
this.tagNamespacePrefix=tagNamespacePrefix;
} }
public TAG_WRITER getContentWriterWrapped() { public TAG_WRITER getContentWriterWrapped() {

View file

@ -23,6 +23,7 @@
package org.x4o.o2o.io.sax3.xdbx; package org.x4o.o2o.io.sax3.xdbx;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.Closeable;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
@ -36,6 +37,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.PrimitiveIterator; import java.util.PrimitiveIterator;
import java.util.Set; import java.util.Set;
import java.util.Stack; import java.util.Stack;
@ -54,10 +56,10 @@ import org.xml.sax.SAXException;
* @author Willem Cazander * @author Willem Cazander
* @version 1.0 Dec 19, 2024 * @version 1.0 Dec 19, 2024
*/ */
public class AbstractXDBXWriterHandler implements ContentHandler { public class AbstractXDBXWriterHandler implements ContentHandler, Closeable {
private final PropertyConfig propertyConfig; private final PropertyConfig propertyConfig;
private OutputStream out = null; private final OutputStream out;
private Map<String,String> prefixMapping = null; private Map<String,String> prefixMapping = null;
private List<String> printedMappings = null; private List<String> printedMappings = null;
private Stack<String> elements = null; private Stack<String> elements = null;
@ -98,37 +100,23 @@ public class AbstractXDBXWriterHandler implements ContentHandler {
* @param out The stream to print the xml to. * @param out The stream to print the xml to.
*/ */
public AbstractXDBXWriterHandler(OutputStream out) { public AbstractXDBXWriterHandler(OutputStream out) {
if (out==null) { this.out = Objects.requireNonNull(out, "Can't write on null OutputStream.");
throw new NullPointerException("Can't write on null OutputStream."); this.prefixMapping = new HashMap<String,String>(15);
} this.printedMappings = new ArrayList<String>(15);
this.out = out; this.elements = new Stack<String>();
prefixMapping = new HashMap<String,String>(15); this.propertyConfig = new PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
printedMappings = new ArrayList<String>(15); this.stringIdx = new HashMap<>();
elements = new Stack<String>();
propertyConfig = new PropertyConfig(DEFAULT_PROPERTY_CONFIG,PROPERTY_CONTEXT_PREFIX);
stringIdx = new HashMap<>();
} }
public PropertyConfig getPropertyConfig() { public PropertyConfig getPropertyConfig() {
return propertyConfig; return propertyConfig;
} }
// TODO: check location of this. (add to api?) @Override
public void closeWriter() throws IOException { public void close() throws IOException {
if (out==null) {
return;
}
out.close(); out.close();
} }
public void closeWriterSafe() {
try {
closeWriter();
} catch (IOException e) {
e.getMessage(); // discard exception
}
}
protected boolean xdbxStringId(String data) { protected boolean xdbxStringId(String data) {
Integer result = stringIdx.get(data); Integer result = stringIdx.get(data);
return result != null; return result != null;

View file

@ -124,61 +124,60 @@ public class ApiDocGenerator implements ApiDocContentPrinter {
pathPrefix += "../"; pathPrefix += "../";
} }
File outputFile = createOutputPathFile(basePath,path.toArray(new String[]{})); File outputFile = createOutputPathFile(basePath,path.toArray(new String[]{}));
ApiDocContentWriter writer = createContentWriter(outputFile); try (ApiDocContentWriter writer = createContentWriter(outputFile)) {
doc.getNodeData().clearGroupTypeLinks();
doc.getNodeData().clearGroupTypeLinks(); doc.getNodeData().setNavSelected(concept.getId());
doc.getNodeData().setNavSelected(concept.getId()); configNodeData(pathPrefix,outputFile);
configNodeData(pathPrefix,outputFile); configActiveNavConceptLinks(node,concept,"/..");
configActiveNavConceptLinks(node,concept,"/.."); configNextPrevLinks(node);
configNextPrevLinks(node); configSubNavLinks(node);
configSubNavLinks(node); configData(node);
configData(node);
ApiDocWriteEvent<ApiDocNode> bodyEvent = new ApiDocWriteEvent<ApiDocNode>(doc,writer,node);
ApiDocWriteEvent<ApiDocNode> bodyEvent = new ApiDocWriteEvent<ApiDocNode>(doc,writer,node); String titleNode = node.getName();
String titleNode = node.getName(); String titleNodeSub = null;
String titleNodeSub = null; if (node.getParent()!=null) {
if (node.getParent()!=null) { titleNodeSub = node.getParent().getId()+":"+node.getId();
titleNodeSub = node.getParent().getId()+":"+node.getId();
}
boolean isNodePageMode = isNodePageMode(node);
String titleContent = titleNode;
if (doc.isPrintConceptTitle()) {
String conceptTitle = concept.getName();
ApiDocConcept childConcept = doc.findConceptChildByNode(node);
if (childConcept!=null) {
conceptTitle = childConcept.getName();
} }
titleContent = conceptTitle +" "+titleNode; boolean isNodePageMode = isNodePageMode(node);
} String titleContent = titleNode;
String titleHtml = titleNode; if (doc.isPrintConceptTitle()) {
if (doc.getDocPageSubTitle()!=null) { String conceptTitle = concept.getName();
titleHtml = titleNode+" ("+doc.getDocPageSubTitle()+")"; ApiDocConcept childConcept = doc.findConceptChildByNode(node);
if (node.getParent()==null) { if (childConcept!=null) {
titleContent = doc.getDocPageSubTitle(); conceptTitle = childConcept.getName();
titleHtml = "Overview ("+doc.getDocPageSubTitle()+")"; }
titleContent = conceptTitle +" "+titleNode;
} }
} String titleHtml = titleNode;
if (doc.getDocPageSubTitle()!=null) {
// Write node file titleHtml = titleNode+" ("+doc.getDocPageSubTitle()+")";
writer.docHtmlStart(titleHtml, doc.getDocKeywords(),doc.getNodeData().getPrefixPath()); if (node.getParent()==null) {
docNavBar(writer,true,concept,node); titleContent = doc.getDocPageSubTitle();
if (isNodePageMode) { titleHtml = "Overview ("+doc.getDocPageSubTitle()+")";
writer.docPageClassStart(titleContent, null,Tag.h1); }
} else {
writer.docPageClassStart(titleContent, titleNodeSub,Tag.h2);
} }
writer.docPageContentStart();
if (!isNodePageMode) { // Write node file
writeNodeTreePath(bodyEvent); writer.docHtmlStart(titleHtml, doc.getDocKeywords(),doc.getNodeData().getPrefixPath());
} docNavBar(writer,true,concept,node);
writeNodeDescription(bodyEvent,isNodePageMode); if (isNodePageMode) {
writeNodeSummary(bodyEvent,isNodePageMode); writer.docPageClassStart(titleContent, null,Tag.h1);
writeNodeDetails(bodyEvent); } else {
writer.docPageContentEnd(); writer.docPageClassStart(titleContent, titleNodeSub,Tag.h2);
writer.docPageClassEnd(); }
docNavBar(writer,false,concept,node); writer.docPageContentStart();
writer.docHtmlEnd(doc.getDocCopyright(),doc.getDocStatsJS()); if (!isNodePageMode) {
writer.getContentWriterWrapped().closeWriterSafe(); writeNodeTreePath(bodyEvent);
}
writeNodeDescription(bodyEvent,isNodePageMode);
writeNodeSummary(bodyEvent,isNodePageMode);
writeNodeDetails(bodyEvent);
writer.docPageContentEnd();
writer.docPageClassEnd();
docNavBar(writer,false,concept,node);
writer.docHtmlEnd(doc.getDocCopyright(),doc.getDocStatsJS());
}
// Writer other files // Writer other files
writeAllFrameNavNode(node); writeAllFrameNavNode(node);
@ -242,7 +241,7 @@ public class ApiDocGenerator implements ApiDocContentPrinter {
if (i+1<bodyWriterDescriptionNode.size()) { if (i+1<bodyWriterDescriptionNode.size()) {
writer.printTagStartEnd(Tag.br); writer.printTagStartEnd(Tag.br);
} }
} }
writer.docPageBlockEnd(); writer.docPageBlockEnd();
writer.printTagEnd(Tag.div); // description writer.printTagEnd(Tag.div); // description
} }
@ -266,7 +265,7 @@ public class ApiDocGenerator implements ApiDocContentPrinter {
if (!isPageMode) { writer.printTagCharacters(Tag.h3, "Summary"); } if (!isPageMode) { writer.printTagCharacters(Tag.h3, "Summary"); }
nodeWriter.writeNodeContent(event); nodeWriter.writeNodeContent(event);
if (!isPageMode) { writer.docPageBlockEnd(); } if (!isPageMode) { writer.docPageBlockEnd(); }
if (isPageMode) { writer.printTagStartEnd(Tag.br); } // mm .. mm if (isPageMode) { writer.printTagStartEnd(Tag.br); }
} }
if (!isPageMode) { if (!isPageMode) {
writer.docPageBlockEnd(); writer.docPageBlockEnd();
@ -638,8 +637,7 @@ public class ApiDocGenerator implements ApiDocContentPrinter {
public void writeIndex() throws IOException { public void writeIndex() throws IOException {
File outputFile = createOutputPathFile(basePath,"index.html"); File outputFile = createOutputPathFile(basePath,"index.html");
ApiDocContentWriter writer = createContentWriter(outputFile); try (ApiDocContentWriter writer = createContentWriter(outputFile)) {
try {
writer.printDocType(DocType.HTML_4_FRAMESET); writer.printDocType(DocType.HTML_4_FRAMESET);
writer.printComment("NewPage"); writer.printComment("NewPage");
writer.printHtmlStart("en"); writer.printHtmlStart("en");
@ -694,8 +692,6 @@ public class ApiDocGenerator implements ApiDocContentPrinter {
writer.printTagEnd(Tag.frameset); writer.printTagEnd(Tag.frameset);
writer.printHtmlEnd(); writer.printHtmlEnd();
} finally {
writer.getContentWriterWrapped().closeWriterSafe();
} }
} }
@ -715,8 +711,7 @@ public class ApiDocGenerator implements ApiDocContentPrinter {
findNodeByUserDataClass(doc.getRootNode(),conceptParent.getConceptClass(),nodes); findNodeByUserDataClass(doc.getRootNode(),conceptParent.getConceptClass(),nodes);
File outputFile = createOutputPathFile(basePath,"overview-frame.html"); File outputFile = createOutputPathFile(basePath,"overview-frame.html");
ApiDocContentWriter writer = createContentWriter(outputFile); try (ApiDocContentWriter writer = createContentWriter(outputFile)) {
try {
String conceptPlural = concept.getName()+"s"; String conceptPlural = concept.getName()+"s";
String conceptParentPlural = conceptParent.getName()+"s"; String conceptParentPlural = conceptParent.getName()+"s";
@ -762,8 +757,6 @@ public class ApiDocGenerator implements ApiDocContentPrinter {
writer.printTagEnd(Tag.body); writer.printTagEnd(Tag.body);
writer.printHtmlEnd(); writer.printHtmlEnd();
} finally {
writer.getContentWriterWrapped().closeWriterSafe();
} }
} }
@ -799,8 +792,7 @@ public class ApiDocGenerator implements ApiDocContentPrinter {
findNodeByUserDataClass(doc.getRootNode(),concept.getConceptClass(),nodes); findNodeByUserDataClass(doc.getRootNode(),concept.getConceptClass(),nodes);
File outputFile = createOutputPathFile(basePath,fileName); File outputFile = createOutputPathFile(basePath,fileName);
ApiDocContentWriter writer = createContentWriter(outputFile); try (ApiDocContentWriter writer = createContentWriter(outputFile)) {
try {
String conceptPlural = concept.getName()+"s"; String conceptPlural = concept.getName()+"s";
//String conceptParentPlural = conceptParent.getName()+"s"; //String conceptParentPlural = conceptParent.getName()+"s";
@ -873,16 +865,13 @@ public class ApiDocGenerator implements ApiDocContentPrinter {
writer.printTagEnd(Tag.body); writer.printTagEnd(Tag.body);
writer.printHtmlEnd(); writer.printHtmlEnd();
} finally {
writer.getContentWriterWrapped().closeWriterSafe();
} }
} }
private void writePage(ApiDocPage page) throws IOException { private void writePage(ApiDocPage page) throws IOException {
File outputFile = createOutputPathFile(basePath,page.getId()+".html"); File outputFile = createOutputPathFile(basePath,page.getId()+".html");
ApiDocContentWriter writer = createContentWriter(outputFile);
String pathPrefix = ""; String pathPrefix = "";
try { try (ApiDocContentWriter writer = createContentWriter(outputFile)) {
configNodeData(pathPrefix,outputFile); configNodeData(pathPrefix,outputFile);
doc.getNodeData().setNavSelected(page.getId()); doc.getNodeData().setNavSelected(page.getId());
String title = page.getName(); String title = page.getName();
@ -901,8 +890,6 @@ public class ApiDocGenerator implements ApiDocContentPrinter {
writer.docPageClassEnd(); writer.docPageClassEnd();
docNavBar(writer,false,null,null); docNavBar(writer,false,null,null);
writer.docHtmlEnd(doc.getDocCopyright(),doc.getDocStatsJS()); writer.docHtmlEnd(doc.getDocCopyright(),doc.getDocStatsJS());
} finally {
writer.getContentWriterWrapped().closeWriterSafe();
} }
} }

View file

@ -31,7 +31,6 @@ import java.io.BufferedWriter;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;
import org.x4o.o2o.io.sax3.ContentWriter;
import org.x4o.o2o.io.sax3.ContentWriterTagWrapper; import org.x4o.o2o.io.sax3.ContentWriterTagWrapper;
import org.x4o.o2o.io.sax3.ContentWriterXml; import org.x4o.o2o.io.sax3.ContentWriterXml;
import org.x4o.o2o.io.sax3.xdbx.XDBXWriterXml; import org.x4o.o2o.io.sax3.xdbx.XDBXWriterXml;
@ -57,19 +56,21 @@ public class WarpCorePlasmaInspectorServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
if ("true".equalsIgnoreCase(request.getParameter("___xdbx"))) { if ("true".equalsIgnoreCase(request.getParameter("___xdbx"))) {
response.setContentType("application/octet-stream"); response.setContentType("application/octet-stream");
ContentWriterInspector writer = new ContentWriterInspector(new XDBXWriterXml(response.getOutputStream())); try (ContentWriterTagWrapper<Tag,?> writer = new ContentWriterTagWrapper<Tag,XDBXWriterXml>(new XDBXWriterXml(response.getOutputStream()))) {
printReport(writer, request); printReport(writer, request);
}
return; return;
} }
response.setContentType("text/xml"); response.setContentType("text/xml");
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
BufferedWriter out = new BufferedWriter(response.getWriter()); BufferedWriter out = new BufferedWriter(response.getWriter());
ContentWriterInspector writer = new ContentWriterInspector(new ContentWriterXml(out, response.getCharacterEncoding())); try (ContentWriterTagWrapper<Tag,?> writer = new ContentWriterTagWrapper<Tag,ContentWriterXml>(new ContentWriterXml(out, response.getCharacterEncoding()))) {
printReport(writer, request); printReport(writer, request);
out.flush(); out.flush();
}
} }
private void printReport(ContentWriterInspector writer, HttpServletRequest request) { private void printReport(ContentWriterTagWrapper<Tag,?> writer, HttpServletRequest request) {
WarpCoreReactor reactor = ZeroFungus.INSTANCE.getWarpCore(); WarpCoreReactor reactor = ZeroFungus.INSTANCE.getWarpCore();
List<WarpReactPlasma> slots = reactor.listChilds(null); List<WarpReactPlasma> slots = reactor.listChilds(null);
try { try {
@ -93,7 +94,7 @@ public class WarpCorePlasmaInspectorServlet extends HttpServlet {
} }
} }
private void printSlotContract(ContentWriterInspector writer, WarpCorePlasmaIntermixChamber contract) throws IOException { private void printSlotContract(ContentWriterTagWrapper<Tag,?> writer, WarpCorePlasmaIntermixChamber contract) throws IOException {
AttributesImpl atts = new AttributesImpl(); AttributesImpl atts = new AttributesImpl();
atts.addAttribute("", "path", "", "", contract.getSlot().getSlotPath()); atts.addAttribute("", "path", "", "", contract.getSlot().getSlotPath());
writer.printTagStart(Tag.slot, atts); writer.printTagStart(Tag.slot, atts);
@ -104,7 +105,7 @@ public class WarpCorePlasmaInspectorServlet extends HttpServlet {
writer.printTagEnd(Tag.slot); writer.printTagEnd(Tag.slot);
} }
private void printClaims(ContentWriterInspector writer, Tag tag, List<Class<?>> clazzes) throws IOException { private void printClaims(ContentWriterTagWrapper<Tag,?> writer, Tag tag, List<Class<?>> clazzes) throws IOException {
if (clazzes.isEmpty()) { if (clazzes.isEmpty()) {
return; return;
} }
@ -118,7 +119,7 @@ public class WarpCorePlasmaInspectorServlet extends HttpServlet {
writer.printTagEnd(tag); writer.printTagEnd(tag);
} }
private void printRequireServices(ContentWriterInspector writer, List<Class<?>> clazzes) throws IOException { private void printRequireServices(ContentWriterTagWrapper<Tag,?> writer, List<Class<?>> clazzes) throws IOException {
if (clazzes.isEmpty()) { if (clazzes.isEmpty()) {
return; return;
} }
@ -129,7 +130,7 @@ public class WarpCorePlasmaInspectorServlet extends HttpServlet {
writer.printTagEnd(Tag.requireServices); writer.printTagEnd(Tag.requireServices);
} }
private void printRequireSlots(ContentWriterInspector writer, List<WarpReactPlasma> slots) throws IOException { private void printRequireSlots(ContentWriterTagWrapper<Tag,?> writer, List<WarpReactPlasma> slots) throws IOException {
if (slots.isEmpty()) { if (slots.isEmpty()) {
return; return;
} }
@ -140,12 +141,12 @@ public class WarpCorePlasmaInspectorServlet extends HttpServlet {
writer.printTagEnd(Tag.requireSlots); writer.printTagEnd(Tag.requireSlots);
} }
public class ContentWriterInspector extends ContentWriterTagWrapper<Tag, ContentWriter> { // public class ContentWriterInspector extends ContentWriterTagWrapper<Tag, ContentWriter> {
//
public ContentWriterInspector(ContentWriter writer) { // public ContentWriterInspector(ContentWriter writer) {
super(writer); // super(writer);
} // }
} // }
public enum Tag { public enum Tag {
reactor, slot, requireSlots, requireSlot, requireServices, requireService, claimIn, claimOut, claimType; reactor, slot, requireSlots, requireSlot, requireServices, requireService, claimIn, claimOut, claimType;