类java.lang.AssertionError源码实例Demo

下面列出了怎么用java.lang.AssertionError的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: epoxy   文件: ModelViewWithParisModel_.java
@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());
        }
      }
    } );
  }
}
 
源代码2 项目: epoxy   文件: StyleableModelViewModel_.java
@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());
        }
      }
    } );
  }
}
 
源代码3 项目: spork   文件: CmdLineParser.java
/**
 * 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);
        }
    }
}
 
 类所在包
 同包方法