Class XmlReaderResult

    • Constructor Detail

      • XmlReaderResult

        public XmlReaderResult​(Object resultObject)
        Construct XmlReaderResult with result object
        Parameters:
        resultObject - the base result object what will load XML, or null if read result has only error(s)
    • Method Detail

      • errorResult

        public static XmlReaderResult errorResult​(String errorMessage)
        Empty XmlReaderResult with one error message
        Parameters:
        errorMessage - the error message, cannot be null
      • 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
      • 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 interface IXmlReadErrorCollector
        Parameters:
        context - the context EObject, cannot be null
        feature - the referenced EStructuralFeature, cannot be null
        node - the xml node, cannot be null
        attributeName - the attribute name, can be null if nodePath 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 interface IXmlReadErrorCollector
        Parameters:
        context - the context EObject, cannot be null
        feature - the referenced EStructuralFeature, cannot be null
        value - the read Object}, can be null
        attributeName - the attribute name, cannot be null
        e - low-level exception, or null if not applicable
      • hasErrors

        public boolean hasErrors()
        Description copied from interface: IXmlReadErrorCollector
        Returns true if this collector has one or many error message, false otherwise.
        Specified by:
        hasErrors in interface IXmlReadErrorCollector
        Returns:
        true if this collector has one or many error message, false otherwise
      • hasWarnings

        public boolean hasWarnings()
        Description copied from interface: IXmlReadErrorCollector
        Returns true if this collector has one or many warnings message, false otherwise.
        Specified by:
        hasWarnings in interface IXmlReadErrorCollector
        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 key
        name - 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 key
        prefix - string while be concatenate with xml nodes text content
        nodes - 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 to IStatus
        Parameters:
        pluginId - the unique identifier of the relevant plug-in, cannot be null
        Returns:
        result IStatus, never null
      • convertToStatus

        public org.eclipse.core.runtime.IStatus convertToStatus​(String pluginId,
                                                                String message)
        Convert error messages of this result to IStatus
        Parameters:
        pluginId - the unique identifier of the relevant plug-in, cannot be null
        message - a human-readable message, localized to the current locale, can be null
        Returns:
        result IStatus, never null