java.lang.Object
esa.opensf.osfi.LoadResult<R>
- Type Parameters:
R- Type of the result object
Immutable type that represents the result of a "load" operation, either from
ParamReader
loading some configuration file, or raw parsing/validation of an XML file.
It encapsulates the actual result together with a list of events of varying severities, e.g.
warnings and errors collected during validation.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classLoadResult.Builder<E extends Exception>Helper that processes events during a load operation to generate aLoadResult.static final class"Event" raised during a load operation (of parameters, of an XML file, etc). -
Field Summary
FieldsModifier and TypeFieldDescriptionfinal List<LoadResult.Event>Events recorded during the process.final RResult of the load operation.static final intPartially recoverable problems with the data source that imply a certain loss of data but which do not prevent further processing.static final intUnrecoverable problems with the data source that stop all processing.static final intGeneral reports that do not represent any problem with the data source.static final intRecoverable issues with the data source e.g.final StringData source for the operation, e.g. -
Method Summary
-
Field Details
-
SEV_INFO
public static final int SEV_INFOGeneral reports that do not represent any problem with the data source.- See Also:
-
SEV_WARNING
public static final int SEV_WARNINGRecoverable issues with the data source e.g. a <parameter> element that still stores its data in the deprecatedvalueattribute.- See Also:
-
SEV_ERROR
public static final int SEV_ERRORPartially recoverable problems with the data source that imply a certain loss of data but which do not prevent further processing. For example, a <parameter> element of MATRIX type that contains an invalid number of columns in a row. The parameter itself cannot be parsed and is lost, but the rest of the file can be parsed.- See Also:
-
SEV_FATAL
public static final int SEV_FATALUnrecoverable problems with the data source that stop all processing. For example, malformed XML in a configuration file will often prevent further parsing, and no results can be extracted.- See Also:
-
source
Data source for the operation, e.g. a file. Never null. -
result
Result of the load operation. May be null if errors stopped the process. -
loadEvents
Events recorded during the process. May be empty but never null.
-
-
Method Details
-
hasEvents
public boolean hasEvents(int minSeverity) - Parameters:
minSeverity- cutoff value, events below this level are not considered.- Returns:
- true if any events with at least the given severity have been recorded.
-
unwrap
If no events at or above the given severity level exist, returnresult. Otherwise, throw aXmlParseExceptionwith the first such event as its cause.- Parameters:
minThrowSeverity- Events below this level will be ignored in the check.- Returns:
- The
resultfield of this instance - Throws:
XmlParseException- if any event with severity equal or higher than the argument exists
-
unwrap
Equivalent to callingunwrap(int)withSEV_ERROR.- Returns:
- The
resultfield of this instance - Throws:
XmlParseException- if any event with severity equal or higher than the argument exists
-