Class InferenceException
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
A
StatementSourceException
indicating an inference problem, e.g. a problem with how statements interact with
each other.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionInferenceException
(@NonNull String message, @NonNull StatementSourceReference source) InferenceException
(@NonNull String message, @NonNull StatementSourceReference source, Throwable cause) InferenceException
(@NonNull String message, @NonNull CommonStmtCtx stmt) InferenceException
(@NonNull String message, @NonNull CommonStmtCtx stmt, Throwable cause) InferenceException
(@NonNull StatementSourceReference source, @NonNull String format, Object... args) InferenceException
(@NonNull CommonStmtCtx stmt, @NonNull String format, Object... args) -
Method Summary
Modifier and TypeMethodDescriptionstatic void
throwIf
(boolean expression, @NonNull StatementSourceReference source, @NonNull String format, Object... args) Throw an instance of this exception if an expression evaluates to true.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.static <T> @NonNull T
throwIfNull
(@Nullable T obj, @NonNull StatementSourceReference source, @NonNull String format, Object... args) Throw an instance of this exception if an object is null.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.Methods inherited from class org.opendaylight.yangtools.yang.model.api.meta.StatementSourceException
sourceRef, throwNSE
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
InferenceException
-
InferenceException
public InferenceException(@NonNull String message, @NonNull StatementSourceReference source, Throwable cause) -
InferenceException
public InferenceException(@NonNull StatementSourceReference source, @NonNull String format, Object... args) -
InferenceException
-
InferenceException
-
InferenceException
-
-
Method Details
-
throwIf
public static void throwIf(boolean expression, @NonNull 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 evaluatedsource
- Statement source referenceformat
- Format string, according toString.format(String, Object...)
.args
- Format string arguments, according toString.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 evaluatedstmt
- Statement contextformat
- Format string, according toString.format(String, Object...)
.args
- Format string arguments, according toString.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 checkedstmt
- Statement context, not retainedformat
- Format string, according toString.format(String, Object...)
.args
- Format string arguments, according toString.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 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 checkedsource
- Statement source referenceformat
- Format string, according toString.format(String, Object...)
.args
- Format string arguments, according toString.format(String, Object...)
- Returns:
- Object if it is not null
- Throws:
InferenceException
- if object is null
-