/**
   * Add the pre-check to see if we are already in the UI thread.
   *
   * @param delegatingMethod
   * @param holder
   * @throws JClassAlreadyExistsException
   */
  private void addUIThreadCheck(
      JMethod delegatingMethod, JBlock previousBody, EComponentHolder holder)
      throws JClassAlreadyExistsException {
    // Get the Thread and Looper class.
    JClass tClass = holder.classes().THREAD;
    JClass lClass = holder.classes().LOOPER;

    // invoke the methods.
    JExpression lhs = tClass.staticInvoke(METHOD_CUR_THREAD);
    JExpression rhs = lClass.staticInvoke(METHOD_MAIN_LOOPER).invoke(METHOD_GET_THREAD);

    // create the conditional and the block.
    JConditional con = delegatingMethod.body()._if(JOp.eq(lhs, rhs));
    JBlock thenBlock = con._then().add(previousBody);
    thenBlock._return();
  }
 @Override
 public JExpression wrapCondifiton(JExpression source) {
   return JOp.ne(source, JExpr._null());
 }
 @Override
 public JExpression unwrapCondifiton(JExpression source) {
   return JOp._instanceof(source, _class);
 }