Class XmlReaderResult
- java.lang.Object
-
- com._1c.g5.v8.dt.import_.xml.reader.XmlReaderResult
-
- All Implemented Interfaces:
IXmlReadErrorCollector
- Direct Known Subclasses:
ConfigurationXmlReaderResult
,FormXmlReaderResult
public class XmlReaderResult extends Object implements IXmlReadErrorCollector
Data to return as result work of xml reader
-
-
Constructor Summary
Constructors Constructor Description XmlReaderResult(Object resultObject)
ConstructXmlReaderResult
with result object
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAllErrorsFrom(IXmlReadErrorCollector errorCollector)
Copies all error messages fromIXmlReadErrorCollector
in this error collector.void
addError(String message)
Adds error message to this error collector.void
addError(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EStructuralFeature feature, IXmlNode node, String attributeName)
Adds error to this error collector, that was occurred during value read by the given node path.void
addError(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EStructuralFeature feature, Object value, String attributeName, Exception e)
Adds error to this error collector, that was occurred during value set to model.void
addUnreadElement(org.eclipse.emf.ecore.EStructuralFeature feature, IXmlNode nodes)
Add all names of object from xml nodes text content in list associate with feature.void
addUnreadElement(org.eclipse.emf.ecore.EStructuralFeature feature, String name)
Add next name of object in list associate with feature.void
addWarning(String message)
Adds warning message to this error collector.org.eclipse.core.runtime.IStatus
convertToStatus(String pluginId)
Convert error messages of this result toIStatus
org.eclipse.core.runtime.IStatus
convertToStatus(String pluginId, String message)
Convert error messages of this result toIStatus
static XmlReaderResult
errorResult(String errorMessage)
EmptyXmlReaderResult
with one error messagestatic XmlReaderResult
errorResult(String errorMessageTemplate, Object... errorMessageArgs)
EmptyXmlReaderResult
with one error messageList<String>
getErrors()
Returns the list of error messages.<T> T
getResultObject()
Get result object loaded from XMLMap<org.eclipse.emf.ecore.EStructuralFeature,List<String>>
getUnreadFeaturesMap()
List<String>
getUnreadNamesByFeature(org.eclipse.emf.ecore.EStructuralFeature feature)
Ordered list of object namesList<String>
getWarnings()
Returns the list of warning messages.boolean
hasErrors()
Returnstrue
if this collector has one or many error message,false
otherwise.boolean
hasWarnings()
Returnstrue
if this collector has one or many warnings message,false
otherwise.
-
-
-
Constructor Detail
-
XmlReaderResult
public XmlReaderResult(Object resultObject)
ConstructXmlReaderResult
with result object- Parameters:
resultObject
- the base result object what will load XML, ornull
if read result has only error(s)
-
-
Method Detail
-
errorResult
public static XmlReaderResult errorResult(String errorMessage)
EmptyXmlReaderResult
with one error message- Parameters:
errorMessage
- the error message, cannot benull
-
errorResult
public static XmlReaderResult errorResult(String errorMessageTemplate, Object... errorMessageArgs)
EmptyXmlReaderResult
with one error message- Parameters:
errorMessageTemplate
- a template for the error message, cannot benull
errorMessageArgs
- the arguments to be substituted into the message template- See Also:
MessageFormat.format(String, Object...)
-
getResultObject
public <T> T getResultObject()
Get result object loaded from XML- Returns:
- the object loaded from XML, can be
null
if an error occurred while reading - Throws:
ClassCastException
- if unsuitable expected type of result object
-
getErrors
public List<String> getErrors()
Description copied from interface:IXmlReadErrorCollector
Returns the list of error messages.- Specified by:
getErrors
in interfaceIXmlReadErrorCollector
- Returns:
- the list of error messages, never
null
-
getWarnings
public List<String> getWarnings()
Description copied from interface:IXmlReadErrorCollector
Returns the list of warning messages.- Specified by:
getWarnings
in interfaceIXmlReadErrorCollector
- Returns:
- the list of warning messages, never
null
-
addError
public void addError(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EStructuralFeature feature, IXmlNode node, String attributeName)
Description copied from interface:IXmlReadErrorCollector
Adds error to this error collector, that was occurred during value read by the given node path.- Specified by:
addError
in interfaceIXmlReadErrorCollector
- Parameters:
context
- the contextEObject
, cannot benull
feature
- the referencedEStructuralFeature
, cannot benull
node
- the xml node, cannot benull
attributeName
- the attribute name, can benull
ifnodePath
defines path to text in the given node
-
addError
public void addError(org.eclipse.emf.ecore.EObject context, org.eclipse.emf.ecore.EStructuralFeature feature, Object value, String attributeName, Exception e)
Description copied from interface:IXmlReadErrorCollector
Adds error to this error collector, that was occurred during value set to model.- Specified by:
addError
in interfaceIXmlReadErrorCollector
- Parameters:
context
- the contextEObject
, cannot benull
feature
- the referencedEStructuralFeature
, cannot benull
value
- the readObject
}, can benull
attributeName
- the attribute name, cannot benull
e
- low-level exception, ornull
if not applicable
-
addError
public void addError(String message)
Description copied from interface:IXmlReadErrorCollector
Adds error message to this error collector.- Specified by:
addError
in interfaceIXmlReadErrorCollector
- Parameters:
message
- the error message, cannot benull
-
addWarning
public void addWarning(String message)
Description copied from interface:IXmlReadErrorCollector
Adds warning message to this error collector.- Specified by:
addWarning
in interfaceIXmlReadErrorCollector
- Parameters:
message
- the warning message, cannot benull
-
addAllErrorsFrom
public void addAllErrorsFrom(IXmlReadErrorCollector errorCollector)
Description copied from interface:IXmlReadErrorCollector
Copies all error messages fromIXmlReadErrorCollector
in this error collector.- Specified by:
addAllErrorsFrom
in interfaceIXmlReadErrorCollector
- Parameters:
errorCollector
- the copy source, cannot benull
-
hasErrors
public boolean hasErrors()
Description copied from interface:IXmlReadErrorCollector
Returnstrue
if this collector has one or many error message,false
otherwise.- Specified by:
hasErrors
in interfaceIXmlReadErrorCollector
- Returns:
true
if this collector has one or many error message,false
otherwise
-
hasWarnings
public boolean hasWarnings()
Description copied from interface:IXmlReadErrorCollector
Returnstrue
if this collector has one or many warnings message,false
otherwise.- Specified by:
hasWarnings
in interfaceIXmlReadErrorCollector
- Returns:
true
if this collector has one or many warnings message,false
otherwise
-
getUnreadFeaturesMap
public Map<org.eclipse.emf.ecore.EStructuralFeature,List<String>> getUnreadFeaturesMap()
- Returns:
Map
contains pair of features to ordered list of object names what can by read in this work
-
addUnreadElement
public void addUnreadElement(org.eclipse.emf.ecore.EStructuralFeature feature, String name)
Add next name of object in list associate with feature.Use this method to save names and order of objects to be read later
- Parameters:
feature
- map keyname
- of object to add in member list
-
addUnreadElement
public void addUnreadElement(org.eclipse.emf.ecore.EStructuralFeature feature, IXmlNode nodes)
Add all names of object from xml nodes text content in list associate with feature.Use this method to save names and order of objects to be read later
- Parameters:
feature
- map keyprefix
- string while be concatenate with xml nodes text contentnodes
- of object to add all in member list
-
getUnreadNamesByFeature
public List<String> getUnreadNamesByFeature(org.eclipse.emf.ecore.EStructuralFeature feature)
Ordered list of object names- Parameters:
feature
- map key- Returns:
- ordered list of object names
-
convertToStatus
public org.eclipse.core.runtime.IStatus convertToStatus(String pluginId)
Convert error messages of this result toIStatus
- Parameters:
pluginId
- the unique identifier of the relevant plug-in, cannot benull
- Returns:
- result
IStatus
, nevernull
-
convertToStatus
public org.eclipse.core.runtime.IStatus convertToStatus(String pluginId, String message)
Convert error messages of this result toIStatus
- Parameters:
pluginId
- the unique identifier of the relevant plug-in, cannot benull
message
- a human-readable message, localized to the current locale, can benull
- Returns:
- result
IStatus
, nevernull
-
-