public class PreconditionExcerpts
extends java.lang.Object
Preconditions methods.| Modifier and Type | Method and Description |
|---|---|
static Excerpt |
checkArgument(java.lang.String conditionTemplate,
java.lang.String messageTemplate,
java.lang.Object... args)
Returns an excerpt equivalent to Guava's
Preconditions.checkArgument(boolean, String, Object...). |
static Excerpt |
checkState(java.lang.String conditionTemplate,
java.lang.String messageTemplate,
java.lang.Object... args)
Returns an excerpt equivalent to Guava's
Preconditions.checkState(boolean, String, Object...). |
public static Excerpt checkArgument(java.lang.String conditionTemplate, java.lang.String messageTemplate, java.lang.Object... args)
Preconditions.checkArgument(boolean, String, Object...).
code.add(checkArgument("%1$s >= 0", "age must be >= 0 (got %1$s)", "age"));condition - a code template 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.String conditionTemplate, java.lang.String messageTemplate, java.lang.Object... args)
Preconditions.checkState(boolean, String, Object...).
code.add(checkState("%1$s < %2$s",
"start must be before end (got %1$s and %2$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