Class InterpretationResult

java.lang.Object
org.openhab.core.voice.text.InterpretationResult

@NonNullByDefault public final class InterpretationResult extends Object
Bundles results of an interpretation. Represents final outcome and user feedback. This class is immutable.
Author:
Tilman Kamp - Initial contribution
  • Field Details

    • OK

      public static final InterpretationResult OK
      Represents successful parsing and interpretation.
    • SYNTAX_ERROR

      public static final InterpretationResult SYNTAX_ERROR
      Represents a syntactical problem during parsing.
    • SEMANTIC_ERROR

      public static final InterpretationResult SEMANTIC_ERROR
      Represents a problem in the interpretation step after successful parsing.
  • Constructor Details

    • InterpretationResult

      public InterpretationResult(String response)
      Constructs a successful result.
      Parameters:
      response - the textual response. Should be short, localized and understandable by non-technical users.
    • InterpretationResult

      public InterpretationResult(InterpretationException exception)
      Constructs an unsuccessful result.
      Parameters:
      exception - the responsible exception
    • InterpretationResult

      public InterpretationResult(boolean success, String response)
      Constructs a result.
      Parameters:
      success - if the result represents a successful or unsuccessful interpretation
      response - the textual response. Should be short, localized and understandable by non-technical users.
  • Method Details

    • isSuccess

      public boolean isSuccess()
      Returns:
      if interpretation was successful
    • getException

      public @Nullable InterpretationException getException()
      Returns:
      the exception
    • getResponse

      public String getResponse()
      Returns:
      the response