下面列出了怎么用java.lang.AssertionError的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
public void handlePreBind(final EpoxyViewHolder holder, final ModelViewWithParis object,
final int position) {
validateStateHasNotChangedSinceAdded("The model was changed between being added to the controller and being bound.", position);
if (!Objects.equals(style, object.getTag(R.id.epoxy_saved_view_style))) {
AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
public void run() {
try {
StyleApplierUtils.Companion.assertSameAttributes(new ModelViewWithParisStyleApplier(object), style, DEFAULT_PARIS_STYLE);
}
catch(AssertionError e) {
throw new IllegalStateException("ModelViewWithParisModel_ model at position " + position + " has an invalid style:\n\n" + e.getMessage());
}
}
} );
}
}
@Override
public void handlePreBind(final EpoxyViewHolder holder, final StyleableModelView object,
final int position) {
validateStateHasNotChangedSinceAdded("The model was changed between being added to the controller and being bound.", position);
if (!Objects.equals(style, object.getTag(R.id.epoxy_saved_view_style))) {
AsyncTask.THREAD_POOL_EXECUTOR.execute(new Runnable() {
public void run() {
try {
StyleApplierUtils.Companion.assertSameAttributes(new StyleableModelViewStyleApplier(object), style, DEFAULT_PARIS_STYLE);
}
catch(AssertionError e) {
throw new IllegalStateException("StyleableModelViewModel_ model at position " + position + " has an invalid style:\n\n" + e.getMessage());
}
}
} );
}
}
/**
* Register a command line option.
* @param c Single character designator for this option. It cannot be '-'.
* @param s Full word designator for this option. This can be null, in which case
* no long designator will exist for this option.
* @param ve If REQUIRED, a value will be expected with this option. If
* OPTIONAL a value will be accepted if it is seen.
* @throws AssertionError if there is no short option, or if this option has already been
* used.
*/
public void registerOpt(char c, String s, ValueExpected ve)
{
if (c == '-') {
throw new AssertionError("CmdLineParser: '-' is not a legal single character designator.");
}
Character cc = Character.valueOf(c);
if (mShort.put(cc, ve) != null) {
throw new AssertionError("CmdLineParser: You have already registered option " + cc.toString());
}
if (mLong != null) {
if (mLong.put(s, cc) != null) {
throw new AssertionError("CmdLineParser: You have already registered option " + s);
}
}
}