org.jooq.lambda.Unchecked.runnable()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中org.jooq.lambda.Unchecked.runnable()方法的一些代码示例,展示了Unchecked.runnable()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Unchecked.runnable()方法的具体详情如下:
包路径:org.jooq.lambda.Unchecked
类名称:Unchecked
方法名:runnable

Unchecked.runnable介绍

[英]Wrap a CheckedRunnable in a Runnable.

Example: ``

new Thread(Unchecked.runnable(() -> { 
throw new Exception("Cannot run this thread"); 
})).start();

[中]将CheckedRunnable包装成Runnable。
示例:``

new Thread(Unchecked.runnable(() -> { 
throw new Exception("Cannot run this thread"); 
})).start();

代码示例

代码示例来源:origin: org.jooq/jool

/**
 * @see {@link Unchecked#runnable(CheckedRunnable)}
 */
static Runnable unchecked(CheckedRunnable runnable) {
  return Unchecked.runnable(runnable);
}

代码示例来源:origin: org.jooq/jool

/**
   * @see {@link Unchecked#runnable(CheckedRunnable, Consumer)}
   */
  static Runnable unchecked(CheckedRunnable runnable, Consumer<Throwable> handler) {
    return Unchecked.runnable(runnable, handler);
  }
}

代码示例来源:origin: org.jooq/jool-java-8

/**
 * @see {@link Unchecked#runnable(CheckedRunnable)}
 */
static Runnable unchecked(CheckedRunnable runnable) {
  return Unchecked.runnable(runnable);
}

代码示例来源:origin: org.jooq/jool

/**
 * Wrap a {@link CheckedRunnable} in a {@link Runnable}.
 * <p>
 * Example:
 * <code><pre>
 * new Thread(Unchecked.runnable(() -> {
 *     throw new Exception("Cannot run this thread");
 * })).start();
 * </pre></code>
 */
public static Runnable runnable(CheckedRunnable runnable) {
  return Unchecked.runnable(runnable, Unchecked.RETHROW_ALL);
}

代码示例来源:origin: org.jooq/jool

/**
 * Wrap a {@link CheckedRunnable} in a {@link Runnable}.
 * <p>
 * Example:
 * <code><pre>
 * new Thread(Unchecked.runnable(() -> {
 *     throw new Exception("Cannot run this thread");
 * })).start();
 * </pre></code>
 */
public static Runnable runnable(CheckedRunnable runnable) {
  return runnable(runnable, THROWABLE_TO_RUNTIME_EXCEPTION);
}

代码示例来源:origin: org.jooq/jool-java-8

/**
 * Wrap a {@link CheckedRunnable} in a {@link Runnable}.
 * <p>
 * Example:
 * <code><pre>
 * new Thread(Unchecked.runnable(() -> {
 *     throw new Exception("Cannot run this thread");
 * })).start();
 * </pre></code>
 */
public static Runnable runnable(CheckedRunnable runnable) {
  return Unchecked.runnable(runnable, Unchecked.RETHROW_ALL);
}

代码示例来源:origin: org.jooq/jool-java-8

/**
   * @see {@link Unchecked#runnable(CheckedRunnable, Consumer)}
   */
  static Runnable unchecked(CheckedRunnable runnable, Consumer<Throwable> handler) {
    return Unchecked.runnable(runnable, handler);
  }
}

代码示例来源:origin: org.jooq/jool-java-8

/**
 * Wrap a {@link CheckedRunnable} in a {@link Runnable}.
 * <p>
 * Example:
 * <code><pre>
 * new Thread(Unchecked.runnable(() -> {
 *     throw new Exception("Cannot run this thread");
 * })).start();
 * </pre></code>
 */
public static Runnable runnable(CheckedRunnable runnable) {
  return runnable(runnable, THROWABLE_TO_RUNTIME_EXCEPTION);
}

代码示例来源:origin: org.jooq/jool

/**
 * Wrap a <code>Reader</code> into a <code>Seq</code>.
 * <p>
 * Client code must close the <code>Reader</code>. All
 * {@link IOException}'s thrown be the <code>Reader</code> are wrapped
 * by {@link UncheckedIOException}'s.
 */
static Seq<Character> seq(Reader reader) {
  if (reader == null)
    return Seq.empty();
  
  FunctionalSpliterator<Character> spliterator = consumer -> {
    try {
      int value = reader.read();
      if (value != -1)
        consumer.accept((char) value);
      return value != -1;
    }
    catch (IOException e) {
      throw new UncheckedIOException(e);
    }
  };
  return seq(spliterator).onClose(Unchecked.runnable(reader::close));
}

代码示例来源:origin: org.jooq/jool

/**
 * Wrap an <code>InputStream</code> into a <code>Seq</code>.
 * <p>
 * Client code must close the <code>InputStream</code>. All
 * {@link IOException}'s thrown be the <code>InputStream</code> are wrapped
 * by {@link UncheckedIOException}'s.
 */
static Seq<Byte> seq(InputStream is) {
  if (is == null)
    return Seq.empty();
  
  FunctionalSpliterator<Byte> spliterator = consumer -> {
    try {
      int value = is.read();
      if (value != -1)
        consumer.accept((byte) value);
      return value != -1;
    }
    catch (IOException e) {
      throw new UncheckedIOException(e);
    }
  };
  return seq(spliterator).onClose(Unchecked.runnable(is::close));
}

代码示例来源:origin: org.jooq/jool-java-8

/**
 * Wrap an <code>InputStream</code> into a <code>Seq</code>.
 * <p>
 * Client code must close the <code>InputStream</code>. All
 * {@link IOException}'s thrown be the <code>InputStream</code> are wrapped
 * by {@link UncheckedIOException}'s.
 */
static Seq<Byte> seq(InputStream is) {
  if (is == null)
    return Seq.empty();
  FunctionalSpliterator<Byte> spliterator = consumer -> {
    try {
      int value = is.read();
      if (value != -1)
        consumer.accept((byte) value);
      return value != -1;
    }
    catch (IOException e) {
      throw new UncheckedIOException(e);
    }
  };
  return seq(spliterator).onClose(Unchecked.runnable(is::close));
}

代码示例来源:origin: org.jooq/jool-java-8

/**
 * Wrap a <code>Reader</code> into a <code>Seq</code>.
 * <p>
 * Client code must close the <code>Reader</code>. All
 * {@link IOException}'s thrown be the <code>Reader</code> are wrapped
 * by {@link UncheckedIOException}'s.
 */
static Seq<Character> seq(Reader reader) {
  if (reader == null)
    return Seq.empty();
  FunctionalSpliterator<Character> spliterator = consumer -> {
    try {
      int value = reader.read();
      if (value != -1)
        consumer.accept((char) value);
      return value != -1;
    }
    catch (IOException e) {
      throw new UncheckedIOException(e);
    }
  };
  return seq(spliterator).onClose(Unchecked.runnable(reader::close));
}

代码示例来源:origin: StubbornJava/StubbornJava

public static void main(String[] args) throws Exception {
    CMSBootstrap.run(Unchecked.runnable(() -> {
      migrate();
      codegen();
    }));
  }
}

代码示例来源:origin: it.unibo.alchemist/alchemist-projectview

/**
 * 
 */
@FXML
public void clickRun() {
  if (this.ctrlCenter.getProject() != null) {
    this.ctrlCenter.checkChanges();
  }
  final Project project = ProjectIOUtils.loadFrom(this.pathFolder);
  if (project != null) {
    final Thread thread = new Thread(Unchecked.runnable(() -> project.runAlchemistSimulation(false)), "SingleRunGUI");
    thread.setDaemon(true);
    thread.start();
  } else {
    final Alert alert = new Alert(AlertType.ERROR);
    alert.setTitle(RESOURCES.getString("error_running"));
    alert.setHeaderText(RESOURCES.getString("error_running_header"));
    alert.setContentText(RESOURCES.getString("error_running_content"));
    alert.showAndWait();
  }
}

相关文章