R - The return type.public abstract class AbstractResourceLoader<R>
extends java.lang.Object
| Constructor | Description |
|---|---|
AbstractResourceLoader(cdc.util.lang.FailureReaction reaction) |
| Modifier and Type | Method | Description |
|---|---|---|
org.apache.logging.log4j.Logger |
getLogger() |
|
cdc.util.lang.FailureReaction |
getReaction() |
|
protected abstract R |
loadRoot(Element root) |
Method that must be implemented by concrete classes to load the file.
|
R |
loadXml(java.io.File file,
cdc.util.compress.Compressor compressor,
XmlDataReader.Feature... features) |
|
R |
loadXml(java.io.File file,
XmlDataReader.Feature... features) |
|
R |
loadXml(java.io.InputStream is,
java.lang.String systemId,
XmlDataReader.Feature... features) |
|
R |
loadXml(java.lang.String filename,
cdc.util.compress.Compressor compressor,
XmlDataReader.Feature... features) |
|
R |
loadXml(java.lang.String filename,
XmlDataReader.Feature... features) |
|
R |
loadXml(java.net.URL url,
cdc.util.compress.Compressor compressor,
XmlDataReader.Feature... features) |
|
R |
loadXml(java.net.URL url,
XmlDataReader.Feature... features) |
|
void |
loadXml(java.util.List<java.net.URL> urls,
cdc.util.compress.Compressor compressor,
XmlDataReader.Feature... features) |
|
void |
loadXml(java.util.List<java.net.URL> urls,
XmlDataReader.Feature... features) |
|
protected void |
onError(java.lang.String message) |
Function that either keeps silent, warns or raises an exception,
depending on error reaction.
|
protected <T> T |
onError(java.lang.String message,
T def) |
Function that either silently returns a value, warns and returns a value
or raises an exception, depending on error reaction.
|
protected <T> T |
onResult(T result,
java.lang.String message,
T def) |
Function that returns a computed value if it is not
null,
or silently returns a default value, warns and returns a default value
or throws an exception. |
protected void |
unexpectedElement(Element element,
java.lang.String... expected) |
|
protected <V> V |
unexpectedElement(Element element,
V def,
java.lang.String... expected) |
public AbstractResourceLoader(cdc.util.lang.FailureReaction reaction)
public final org.apache.logging.log4j.Logger getLogger()
public final cdc.util.lang.FailureReaction getReaction()
public final R loadXml(java.io.File file, cdc.util.compress.Compressor compressor, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic final R loadXml(java.io.File file, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic final R loadXml(java.lang.String filename, cdc.util.compress.Compressor compressor, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic final R loadXml(java.lang.String filename, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic final R loadXml(java.net.URL url, cdc.util.compress.Compressor compressor, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic final R loadXml(java.net.URL url, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionpublic final void loadXml(java.util.List<java.net.URL> urls,
cdc.util.compress.Compressor compressor,
XmlDataReader.Feature... features)
public final void loadXml(java.util.List<java.net.URL> urls,
XmlDataReader.Feature... features)
public final R loadXml(java.io.InputStream is, java.lang.String systemId, XmlDataReader.Feature... features) throws java.io.IOException
java.io.IOExceptionprotected abstract R loadRoot(Element root)
root - The root element.protected final void onError(java.lang.String message)
message - The error message.DataException - When error reaction is FailureReaction.FAIL.protected final <T> T onError(java.lang.String message,
T def)
T - The return type.message - The error message.def - The default return value.def if error reaction is FailureReaction.DEFAULT
or FailureReaction.WARN.DataException - When error reaction is FailureReaction.FAIL.protected final <T> T onResult(T result,
java.lang.String message,
T def)
null,
or silently returns a default value, warns and returns a default value
or throws an exception.T - The return type.result - The computed result.message - The error message.def - The default return value.result if it is not null, or def if
error reaction is FailureReaction.DEFAULT
or FailureReaction.WARN.DataException - When result is null
and error reaction is FailureReaction.FAIL.protected final void unexpectedElement(Element element, java.lang.String... expected)
protected final <V> V unexpectedElement(Element element, V def, java.lang.String... expected)
Copyright © 2019. All rights reserved.