public class PreconditionExcerpts
extends java.lang.Object
Preconditions methods.| Modifier and Type | Method and Description |
|---|---|
static Excerpt |
checkArgument(java.lang.Object condition,
java.lang.String message,
java.lang.Object... args)
Returns an excerpt equivalent to Guava's
Preconditions.checkArgument(boolean, String, Object...). |
static Excerpt |
checkState(java.lang.Object condition,
java.lang.String message,
java.lang.Object... args)
Returns an excerpt equivalent to Guava's
Preconditions.checkState(boolean, String, Object...). |
public static Excerpt checkArgument(java.lang.Object condition, java.lang.String message, java.lang.Object... args)
Preconditions.checkArgument(boolean, String, Object...).
code.add(checkArgument("age >= 0", "age must be non-negative (got %s)", "age"));condition - an excerpt containing the expression to pass to the checkArgument methodmessage - the error message template to pass to the checkArgument methodargs - excerpts containing the error message arguments to pass to the checkArgument methodpublic static Excerpt checkState(java.lang.Object condition, java.lang.String message, java.lang.Object... args)
Preconditions.checkState(boolean, String, Object...).
code.add(checkState("start < end",
"start must be before end (got %s and %s)", "start", "end"));condition - an excerpt containing the expression to pass to the checkState methodmessage - the error message template to pass to the checkState methodargs - excerpts containing the error message arguments to pass to the checkState method