JetBrains Fleet 1.48 ヘルプ

Java 後置補完テンプレートのリスト

この表は、Java コードで使用できる後置補完テンプレートをまとめたものです。

名前

説明

例: 前

例: 後

!

ブール式を否定します。

public class Foo { void m(boolean b) { m(b!); } }
public class Foo { void m(boolean b) { m(!b); } }

arg

オブジェクトを関数呼び出しでラップします。

public class Foo { void m(Object o) { o.arg } }
public class Foo { void m(Object o) { call(o) } }

assert

ブール式からアサーションを作成します。

public void m(boolean value) { value.assert }
public void m(boolean value) { assert value; }

cast

式をキャストで囲みます。

public class Foo { void m(Object o) { o.cast } }
public class Foo { void m(Object o) { (() o) } }

castvar

型キャストを使用して式の新しい変数を作成します。

void m(Object o) { if (o instanceof String) { o.castvar } }
void m(Object o) { if (o instanceof String) { String o = (String)o; } }

else

ブール式が false であることを確認するチェックを追加します。

public class Foo { void m(boolean b) { b.else } }
public class Foo { void m(boolean b) { if (!b) { } } }

field

式のフィールドを導入します。

public class Foo { public Foo(int arg) { arg.field } }
public class Foo { private int foo; public Foo(int arg) { foo = arg; } }

for

列挙可能なコレクションを反復処理します。

public class Foo { void m() { int[] values = {1, 2, 3}; values.for } }
public class Foo { void m() { int[] values = {1, 2, 3}; for (int value : values) { } } }

fori

コレクションに対してインデックスを反復処理します。

public class Foo { void m() { int foo = 100; foo.fori } }
public class Foo { void m() { int foo = 100; for (int i = 0; i < foo; i++) { } } }

format

String.format 呼び出しを作成します。

public void m(String value) { value.format }
public void m(String value) { String.format(value, ); }

forr

インデックスを逆の順序で繰り返します。テンプレートを配列またはリストで使用して、その要素を逆の順序で反復することもできます。

public class Foo { void m() { int foo = 100; foo.forr } }
public class Foo { void m() { int foo = 100; for (int i = foo; i &gt; 0; i--) { } } }

if

ブール式が true であることを検証するチェックを追加します。

public class Foo { void m(boolean b) { b.if } }
public class Foo { void m(boolean b) { if (b) { } } }

inst

式を instanceof で囲みます。

public class Foo { void m(Object o) { o.inst } }
public class Foo { void m(Object o) { o instanceof ? (() o) : null; } }

instanceof

式を instanceof で囲みます。

public class Foo { void m(Object o) { o.instanceof } }
public class Foo { void m(Object o) { o instanceof ? (() o) : null; } }

iter

列挙可能なコレクションを反復処理します。

public class Foo { void m() { int[] values = {1, 2, 3}; values.iter } }
public class Foo { void m() { int[] values = {1, 2, 3}; for (int value : values) { } } }

lambda

式をラムダで囲みます。

public void m() { foo().lambda }
public void m() { () -&gt; foo() }

new

クラスの新しい呼び出しを挿入します。

Foo.new
new Foo()

nn

式が null ではないことを確認するチェックを追加します。

public class Foo { void m(Object o) { o.nn } }
public class Foo { void m(Object o) { if (o != null){ } } }

not

ブール式を否定します。

public class Foo { void m(boolean b) { m(b.not); } }
public class Foo { void m(boolean b) { m(!b); } }

notnull

式が null ではないことを確認するチェックを追加します。

public class Foo { void m(Object o) { o.notnull } }
public class Foo { void m(Object o) { if (o != null){ } } }

null

式が null であることを確認するチェックを追加します。

public class Foo { void m(Object o) { o.null } }
public class Foo { void m(Object o) { if (o == null){ } } }

opt

オプションのオブジェクトを作成します。

public void m(int intValue, double doubleValue, long longValue, Object objValue) { intValue.opt doubleValue.opt longValue.opt objValue.opt }
public void m(int intValue, double doubleValue, long longValue, Object objValue) { OptionalInt.of(intValue) OptionalDouble.of(doubleValue) OptionalLong.of(longValue) Optional.ofNullable(objValue) }

par

式を括弧で囲みます。

public class Foo { void m(Object o) { o.par } }
public class Foo { void m(Object o) { (o) } }

reqnonnull

オブジェクトを Objects.requireNonNull でラップします。

public class Foo { void m(Object o) { o.reqnonnull } }
public class Foo { void m(Object o) { Objects.requireNonNull(o) } }

return

含まれているメソッドから値を返します。

public class Foo { String m() { "result".return } }
public class Foo { String m() { return "result"; } }

serr

System.err.println 呼び出しを作成します。

public class Foo { void m(boolean b) { b.serr } }
public class Foo { void m(boolean b) { System.err.println(b); } }

souf

System.out.printf 呼び出しを作成します。

public class Foo { void m(boolean b) { b.souf } }
public class Foo { void m(boolean b) { System.out.printf("", b); } }

sout

System.out.println 呼び出しを作成します。

public class Foo { void m(boolean b) { b.sout } }
public class Foo { void m(boolean b) { System.out.println(b); } }

soutv

出力された値の呼び出しの説明を含む System.out.println を作成します。

public class Foo { void m(boolean b) { b.soutv } }
public class Foo { void m(boolean b) { System.out.println("b = " + b); } }

stream

Arrays.stream 呼び出しを作成します。

public void m(String[] array) { array.stream }
public void m(String[] array) { Arrays.stream(array) }

switch

整数 / 列挙型 / 文字列値の切り替えを生成します。

public enum Foo { A, B, C; void f(Foo foo) { foo.switch } }
public enum Foo { A, B, C; void f(Foo foo) { switch (foo) { } } }

synchronized

同期ステートメントを生成します。

public class Foo { void m(Object o) { o.synchronized } }
public class Foo { void m(Object o) { synchronized (o) { } } }

test

Flux/Mono を actor.test.StepVerifier.create メソッド呼び出しでラップします。

public void m() { Flux.just(1).test Flux.just(2).testN }
public void m() { StepVerifier.create(Flux.just(1)) StepVerifier.create(Flux.just(2), ) }

testN

Flux/Mono を actor.test.StepVerifier.create メソッド呼び出しでラップします。

public void m() { Flux.just(1).test Flux.just(2).testN }
public void m() { StepVerifier.create(Flux.just(1)) StepVerifier.create(Flux.just(2), ) }

throw

Throwable 型の式をスローします。

public class Foo { void m() { new RuntimeException("error").throw } }
public class Foo { void m() { throw new RuntimeException("error"); } }

toCompletable

適切な RxJava2 または RxJava3 Completable ファクトリで式をラップします。

public void m(Throwable error, String s, Future<Integer> future, Callable<String> callable, Single<String> single) { error.toCompletable s.toCompletable future.toCompletable callable.toCompletable single.toCompletable }
public void m(Throwable error, String s, Future<Integer> future, Callable<String> callable, Single<String> single) { Completable.error(error) Completable.complete() Completable.fromFuture(future) Completable.fromCallable(callable) Completable.fromSingle(single) }

toFlowable

適切な RxJava2 または RxJava3 Flowable ファクトリで式をラップします。

public void m(Throwable error, String s, List<Integer> list, String[] array, Publisher<Integer> p, Stream<Integer> stream) { error.toFlowable s.toFlowable list.toFlowable array.toFlowable p.toFlowable stream.toFlowable }
public void m(Throwable error, String s, List<Integer> list, String[] array, Publisher<Integer> p, Stream<Integer> stream) { Flowable.error(error) Flowable.just(s) Flowable.fromIterable(list) Flowable.fromArray(array) Flowable.fromPublisher(p) Flowable.fromStream(stream) }

toFlux

式を適切な actor.core.publisher.Flux ファクトリでラップします。

public void m(Throwable error, String s, List<Integer> list, String[] array, Mono<Integer> mono, Stream<Integer> stream) { error.toFlux s.toFlux list.toFlux array.toFlux mono.toFlux stream.toFlux }
public void m(Throwable error, String s, List<Integer> list, String[] array, Mono<Integer> mono, Stream<Integer> stream) { Flux.error(error) Flux.just(s) Flux.fromIterable(list) Flux.fromArray(array) Flux.from(mono) Flux.fromStream(stream) }

toMaybe

式を適切な RxJava2 または RxJava3 の Maybe ファクトリでラップします。

public void m(Throwable error, String s, Future<Integer> future, Callable<String> callable, Single<String> single) { error.toMaybe s.toMaybe future.toMaybe callable.toMaybe single.toMaybe }
public void m(Throwable error, String s, Future<Integer> future, Callable<String> callable, Single<String> single) { Maybe.error(error) Maybe.just(s) Maybe.fromFuture(future) Maybe.fromCallable(callable) Maybe.fromSingle(single) }

toMono

式を適切な actor.core.publisher.Mono ファクトリでラップします。

public void m(Throwable error, String s, CompletableFuture<Integer> future, Callable<String> callable, Mono<Integer> mono, Supplier<Double> sup) { error.toMono s.toMono future.toMono callable.toMono mono.toMono sup.toMono }
public void m(Throwable error, String s, CompletableFuture<Integer> future, Callable<String> callable, Mono<Integer> mono, Supplier<Double> sup) { Mono.error(error) Mono.just(s) Mono.fromFuture(future) Mono.fromCallable(callable) Mono.from(mono) Mono.fromSupplier(sup) }

toObservable

適切な RxJava2 または RxJava3 Observable ファクトリで式をラップします。

public void m(Throwable error, String s, List<Integer> list, String[] array, Publisher<Integer> p, Stream<Integer> stream) { error.toObservable s.toObservable list.toObservable array.toObservable p.toObservable stream.toObservable }
public void m(Throwable error, String s, List<Integer> list, String[] array, Publisher<Integer> p, Stream<Integer> stream) { Observable.error(error) Observable.just(s) Observable.fromIterable(list) Observable.fromArray(array) Observable.fromPublisher(p) Observable.fromStream(stream) }

toSingle

適切な RxJava2 または RxJava3 Single ファクトリで式をラップします。

public void m(Throwable error, String s, Future<Integer> future, Callable<String> callable, Maybe<String> maybe) { error.toSingle s.toSingle future.toSingle callable.toSingle maybe.toSingle }
public void m(Throwable error, String s, Future<Integer> future, Callable<String> callable, Maybe<String> maybe) { Single.error(error) Single.just(s) Single.fromFuture(future) Single.fromCallable(callable) Single.fromMaybe(maybe) }

try

try-catch ブロックにステートメントを挿入します。

public void m2() { m().try } public void m() throws CheckedException { }
public void m2() { try { m(); } catch(CheckedException e) { e.printStackTrace(); } } public void m() throws CheckedException { }

twr

try-with-resources ブロックにステートメントを挿入します (Java 7 以降が必要です)。

public class Foo { void m() { getStream().twr } AutoCloseable getStream() { return null; } }
public class Foo { void m() { try (AutoCloseable stream = getStream()) { } catch (Exception e) { } } AutoCloseable getStream() { return null; } }

val

式に lombok.val 変数を導入します。

public class Foo { void m(Object o) { String.valueOf(123).val } }
public class Foo { void m(Object o) { lombok.val foo = String.valueOf(123); } }

var

式に変数を導入します。

public class Foo { void m(Object o) { o instanceof String.var } }
public class Foo { void m(Object o) { boolean foo = o instanceof String; } }

varl

式に lombok.var 変数を導入します。

public class Foo { void m(Object o) { String.valueOf(123).varl } }
public class Foo { void m(Object o) { lombok.var foo = String.valueOf(123); } }

while

ブールステートメントが true の間、反復されます。

public class Foo { void m(boolean x) { x.while return; } }
public class Foo { void m(boolean x) { while (x) { } return; } }
2025 年 2 月 26 日