Interface ObjectParser<T>

Type Parameters:
T - The object type.
All Known Subinterfaces:
ItemParser, RootUIComponentParser, RuleParser, RuleTemplateParser, SemanticTagParser, SitemapParser, ThingParser, UIComponentParser

@NonNullByDefault public interface ObjectParser<T>
A generic interface for parsers that parse strings into specific object types like Things, Items, Rules etc.
Author:
Ravi Nadahar - Initial contribution
  • Method Details

    • getParserFormat

      String getParserFormat()
      Get the name of the format.
      Returns:
      The format name.
    • startParsingFormat

      @Nullable String startParsingFormat(String syntax, List<String> errors, List<String> warnings)
      Parse the provided syntax in format without impacting any object registries.
      Parameters:
      syntax - the syntax in format.
      errors - the List to use to report errors.
      warnings - the List to be used to report warnings.
      Returns:
      The model name used for parsing if the parsing succeeded without errors; null otherwise.
    • getParsedObjects

      Collection<? extends T> getParsedObjects(String modelName)
      Get a copy of the collection of objects that were found when parsing the format.
      Parameters:
      modelName - the model name whose objects to get.
      Returns:
      The Collection of objects.
      Implementation note:
      It's important that a copy of the Collection is returned, so that invoking finishParsingFormat(String) doesn't modify the returned result.
    • finishParsingFormat

      void finishParsingFormat(String modelName)
      Release the resources from a previously started format parsing.
      Parameters:
      modelName - the model name whose resources to release.