java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
org.opendaylight.yangtools.yang.model.api.meta.StatementSourceException
org.opendaylight.yangtools.yang.parser.spi.meta.InferenceException
All Implemented Interfaces:
Serializable

public final class InferenceException extends org.opendaylight.yangtools.yang.model.api.meta.StatementSourceException
A StatementSourceException indicating an inference problem, e.g. a problem with how statements interact with each other.
See Also:
  • Constructor Details

    • InferenceException

      public InferenceException(@NonNull String message, @NonNull org.opendaylight.yangtools.yang.model.api.meta.StatementSourceReference source)
    • InferenceException

      public InferenceException(@NonNull String message, @NonNull org.opendaylight.yangtools.yang.model.api.meta.StatementSourceReference source, Throwable cause)
    • InferenceException

      public InferenceException(@NonNull org.opendaylight.yangtools.yang.model.api.meta.StatementSourceReference source, @NonNull String format, Object... args)
    • InferenceException

      public InferenceException(@NonNull String message, @NonNull CommonStmtCtx stmt)
    • InferenceException

      public InferenceException(@NonNull String message, @NonNull CommonStmtCtx stmt, Throwable cause)
    • InferenceException

      public InferenceException(@NonNull CommonStmtCtx stmt, @NonNull String format, Object... args)
  • Method Details

    • throwIf

      public static void throwIf(boolean expression, @NonNull org.opendaylight.yangtools.yang.model.api.meta.StatementSourceReference source, @NonNull String format, Object... args)
      Throw an instance of this exception if an expression evaluates to true. If the expression evaluates to false, this method does nothing.
      Parameters:
      expression - Expression to be evaluated
      source - Statement source reference
      format - Format string, according to String.format(String, Object...).
      args - Format string arguments, according to String.format(String, Object...)
      Throws:
      InferenceException - if the expression evaluates to true.
    • throwIf

      public static void throwIf(boolean expression, @NonNull CommonStmtCtx stmt, @NonNull String format, Object... args)
      Throw an instance of this exception if an expression evaluates to true. If the expression evaluates to false, this method does nothing.
      Parameters:
      expression - Expression to be evaluated
      stmt - Statement context
      format - Format string, according to String.format(String, Object...).
      args - Format string arguments, according to String.format(String, Object...)
      Throws:
      InferenceException - if the expression evaluates to true.
    • throwIfNull

      public static <T> @NonNull T throwIfNull(@Nullable T obj, @NonNull CommonStmtCtx stmt, @NonNull String format, Object... args)
      Throw an instance of this exception if an object is null. If the object is non-null, it will be returned as the result of this method.
      Parameters:
      obj - Object reference to be checked
      stmt - Statement context, not retained
      format - Format string, according to String.format(String, Object...).
      args - Format string arguments, according to String.format(String, Object...)
      Returns:
      Object if it is not null
      Throws:
      InferenceException - if object is null
    • throwIfNull

      public static <T> @NonNull T throwIfNull(@Nullable T obj, @NonNull org.opendaylight.yangtools.yang.model.api.meta.StatementSourceReference source, @NonNull String format, Object... args)
      Throw an instance of this exception if an object is null. If the object is non-null, it will be returned as the result of this method.
      Parameters:
      obj - Object reference to be checked
      source - Statement source reference
      format - Format string, according to String.format(String, Object...).
      args - Format string arguments, according to String.format(String, Object...)
      Returns:
      Object if it is not null
      Throws:
      InferenceException - if object is null