Last active
November 20, 2023 02:36
-
-
Save aodiquan/782605bc3541cb628ebc5e1fd403a959 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Templates for custom ## | |
.toArray : convert to array | |
java.util.Collection → $expr$.toArray(new $arrayType:guessElementType(expr)):"Object"$[0]) | |
.toList : convert to List | |
ARRAY → java.util.Arrays.asList($expr$) | |
java.util.Collection → new java.util.ArrayList<>($expr$) | |
java.lang.Iterable → java.util.stream.StreamSupport.stream($expr$.spliterator(), false).collect(java.util.stream.Collectors.toList()) | |
java.util.Map → new ArrayList<>($expr$.entrySet()) | |
java.util.Optional → $expr$.map(e -> Collections.singletonList(e)).orElse(Collections.emptyList()) | |
java.util.stream.Stream → $expr$.collect(java.util.stream.Collectors.toList()) | |
.toSet : convert to Set | |
ARRAY → java.util.stream.Stream.of($expr$).collect(java.util.stream.Collectors.toSet()) | |
java.util.Collection → new java.util.HashSet<>($expr$) | |
java.lang.Iterable → java.util.stream.StreamSupport.stream($expr$.spliterator(), false).collect(java.util.stream.Collectors.toSet()) | |
java.util.Map → $expr$.entrySet() | |
java.util.Optional → $expr$.map(e -> Collections.singleton(e)).orElse(Collections.emptySet()) | |
java.util.stream.Stream → $expr$.collect(java.util.stream.Collectors.toSet()) | |
.toMap : convert to Map | |
ARRAY → java.util.Arrays.stream($expr$).collect(java.util.stream.Collectors.toMap(e -> $key$, e -> $value$, (o1, o2) -> o1)) | |
java.util.Collection → $expr$.stream().filter().collect(java.util.stream.Collectors.toMap(e -> $key$, e -> $value$, (o1, o2) -> o1)) | |
java.lang.Iterable → java.util.stream.StreamSupport.stream($expr$.spliterator(), false).collect(java.util.stream.Collectors.toMap(e -> $key$, e -> $value$, (o1, o2) -> o1)) | |
java.util.stream.Stream → $expr$.collect(java.util.stream.Collectors.toMap(e -> $key$, e -> $value$, (o1, o2) -> o1)) | |
java.util.Map → $expr$.entrySet().stream().collect(java.util.stream.Collectors.toMap(e -> $key$, e -> $value$, (o1, o2) -> o1)) | |
.of : wrap in Otional.of | |
NON_VOID → java.util.Optional.of($expr$) | |
.ofNullable : wrap in Otional.ofNullable | |
NON_VOID → java.util.Optional.ofNullable($expr$) | |
.stream : convert to Stream | |
java.lang.Iterable → java.util.stream.StreamSupport.stream($expr$.spliterator(), false) | |
.hasEmpty : ht>是否存在null或空对象,通过{@linkObjectUtil#isEmpty(Object)}判断元素 | |
ARRAY [cn.hutool.core.util.ArrayUtil] → cn.hutool.core.util.ArrayUtil.hasEmpty($expr$) | |
.isAllNotEmpty : ht>是否存都不为null或空对象,通过{@linkObjectUtil#isEmpty(Object)}判断元素 | |
ARRAY [cn.hutool.core.util.ArrayUtil] → cn.hutool.core.util.ArrayUtil.isAllNotEmpty($expr$) | |
.isAllEmpty : ht>是否全都为null或空对象,通过{@linkObjectUtil#isEmpty(Object)}判断元素 | |
ARRAY [cn.hutool.core.util.ObjectUtil] → cn.hutool.core.util.ObjectUtil.isAllEmpty($expr$) | |
.hasNull : ht>是否存在null对象,通过{@linkObjectUtil#isNull(Object)}判断元素 | |
ARRAY [cn.hutool.core.util.ObjectUtil] → cn.hutool.core.util.ObjectUtil.hasNull($expr$) | |
.isEmpty : 是否为空 | |
ARRAY [org.springframework.util.CollectionUtils] → org.springframework.util.CollectionUtils.isEmpty($expr$) | |
java.util.List [org.springframework.util.CollectionUtils] → org.springframework.util.CollectionUtils.isEmpty($expr$) | |
java.util.Map [cn.hutool.core.map.MapUtil] → cn.hutool.core.map.MapUtil.isEmpty($expr$) | |
java.lang.CharSequence [cn.hutool.core.text.CharSequenceUtil] → cn.hutool.core.text.CharSequenceUtil.isEmpty($expr$) | |
.length : ht>计算对象长度,如果是字符串调用其length函数,集合类调用其size函数,数组调用其length属性,其他可遍历对象遍历计算长度 | |
java.lang.Object [cn.hutool.core.util.ObjectUtil] → cn.hutool.core.util.ObjectUtil.length($expr$) | |
.equals : 比较两个对象是否相等 | |
java.lang.Object [java.util.Objects] → java.util.Objects.equals($expr$, $arg$) | |
.contains : ht>对象中是否包含元素 | |
java.lang.Object [cn.hutool.core.util.ObjectUtil] → cn.hutool.core.util.ObjectUtil.contains($expr$, $arg$) | |
## collection iterations ## | |
.for : iterate over ... | |
ITERABLE_OR_ARRAY → for ($ELEMENT_TYPE:iterableComponentType(expr):"java.lang.Object"$ $VAR:suggestVariableName()$ : $expr$) {\ | |
$END$\ | |
} | |
java.util.Enumeration → while($expr$.hasMoreElements()) {\ | |
$TYPE:rightSideType():"Object"$ $VAR:suggestVariableName()$ = $CAST*:castToLeftSideType()$ $expr$.nextElement();\ | |
$END$\ | |
} | |
java.util.Iterator → while($expr$.hasNext()) {\ | |
$TYPE:rightSideType():"Object"$ $VAR:suggestVariableName()$ = $CAST*:castToLeftSideType()$ $expr$.next();\ | |
$END$\ | |
} | |
.iter : iterate over ... | |
ITERABLE_OR_ARRAY → for ($ELEMENT_TYPE:iterableComponentType(expr):"java.lang.Object"$ $VAR:suggestVariableName()$ : $expr$) {\ | |
$END$\ | |
} | |
java.util.Enumeration → while($expr$.hasMoreElements()) {\ | |
$TYPE:rightSideType():"Object"$ $VAR:suggestVariableName()$ = $CAST*:castToLeftSideType()$ $expr$.nextElement();\ | |
$END$\ | |
} | |
java.util.Iterator → while($expr$.hasNext()) {\ | |
$TYPE:rightSideType():"Object"$ $VAR:suggestVariableName()$ = $CAST*:castToLeftSideType()$ $expr$.next();\ | |
$END$\ | |
} | |
## collection operations ## | |
.sort : sort naturally | |
ARRAY → java.util.Arrays.sort($expr$) | |
java.util.List → java.util.Collections.sort($expr$) | |
.sortBy : sort by attribute | |
ARRAY → java.util.Arrays.sort($expr$, java.util.Comparator.comparing($attributeVar:suggestShortVariableName()$ -> $attribute$)) | |
java.util.List → $expr$.sort(java.util.Comparator.comparing($attributeVar:suggestShortVariableName()$ -> $attribute$)) | |
java.util.stream.Stream → $expr$.sorted(java.util.Comparator.comparing($attributeVar:suggestShortVariableName()$ -> $attribute$)) | |
.minBy : minimum by attribute | |
ARRAY → java.util.Arrays.stream($expr$).min(java.util.Comparator.comparing($attributeVar:suggestShortVariableName()$ -> $attribute$)) | |
java.util.Collection → $expr$.stream().min(java.util.Comparator.comparing($attributeVar:suggestShortVariableName()$ -> $attribute$)) | |
java.lang.Iterable → java.util.stream.StreamSupport.stream($expr$.spliterator(), false).min(java.util.Comparator.comparing($attributeVar:suggestShortVariableName()$ -> $attribute$)) | |
java.util.stream.Stream → $expr$.min(java.util.Comparator.comparing($attributeVar:suggestShortVariableName()$ -> $attribute$)) | |
.maxBy : maximum by attribute | |
ARRAY → java.util.Arrays.stream($expr$).max(java.util.Comparator.comparing($attributeVar:suggestShortVariableName()$ -> $attribute$)) | |
java.util.Collection → $expr$.stream().max(java.util.Comparator.comparing($attributeVar:suggestShortVariableName()$ -> $attribute$)) | |
java.lang.Iterable → java.util.stream.StreamSupport.stream($expr$.spliterator(), false).max(java.util.Comparator.comparing($attributeVar:suggestShortVariableName()$ -> $attribute$)) | |
java.util.stream.Stream → $expr$.max(java.util.Comparator.comparing($attributeVar:suggestShortVariableName()$ -> $attribute$)) | |
.groupBy : group by attribute | |
ARRAY → java.util.Arrays.stream($expr$).collect(java.util.stream.Collectors.groupingBy($attributeVar:suggestShortVariableName()$ -> $attribute$)) | |
java.util.Collection → $expr$.stream().collect(java.util.stream.Collectors.groupingBy($attributeVar:suggestShortVariableName()$ -> $attribute$)) | |
java.lang.Iterable → java.util.stream.StreamSupport.stream($expr$.spliterator(), false).collect(java.util.stream.Collectors.groupingBy($attributeVar:suggestShortVariableName()$ -> $attribute$)) | |
java.util.stream.Stream → $expr$.collect(java.util.stream.Collectors.groupingBy($attributeVar:suggestShortVariableName()$ -> $attribute$)) | |
.exists : any match | |
ARRAY → java.util.Arrays.stream($expr$).anyMatch($conditionVar:suggestShortVariableName()$ -> $condition$) | |
java.util.Collection → $expr$.stream().anyMatch($conditionVar:suggestShortVariableName()$ -> $condition$) | |
java.lang.Iterable → java.util.stream.StreamSupport.stream($expr$.spliterator(), false).anyMatch($conditionVar:suggestShortVariableName()$ -> $condition$) | |
java.util.stream.Stream → $expr$.anyMatch($conditionVar:suggestShortVariableName()$ -> $condition$) | |
.forall : all match | |
ARRAY → java.util.Arrays.stream($expr$).allMatch($conditionVar:suggestShortVariableName()$ -> $condition$) | |
java.util.Collection → $expr$.stream().allMatch($conditionVar:suggestShortVariableName()$ -> $condition$) | |
java.lang.Iterable → java.util.stream.StreamSupport.stream($expr$.spliterator(), false).allMatch($conditionVar:suggestShortVariableName()$ -> $condition$) | |
java.util.stream.Stream → $expr$.allMatch($conditionVar:suggestShortVariableName()$ -> $condition$) | |
.reverse : reverse collection | |
ARRAY [org.apache.commons.lang.ArrayUtils] → org.apache.commons.lang.ArrayUtils.reverse($expr$) | |
java.util.List → java.util.Collections.reverse($expr$) | |
java.lang.String → new StringBuilder($expr$).reverse().toString() | |
.concat : concat | |
ARRAY → java.util.stream.Stream.concat(java.util.Arrays.stream($expr$), $stream$) | |
java.util.Collection → java.util.stream.Stream.concat($expr$.stream(), $stream$) | |
java.util.stream.Stream → java.util.stream.Stream.concat($expr$, $stream$) | |
.forEach : for each | |
ARRAY → java.util.Arrays.stream($expr$).forEach($actionVar:suggestShortVariableName()$ -> $END$) | |
java.util.Optional → $expr$.ifPresent($actionVar:suggestShortVariableName()$ -> $END$) | |
.join : joins strings/elements together | |
ARRAY → java.util.Arrays.stream($expr$).collect(java.util.stream.Collectors.joining($separator$)) | |
java.util.Collection → $expr$.stream().collect(java.util.stream.Collectors.joining($separator$)) | |
java.lang.Iterable → java.util.stream.StreamSupport.stream($expr$.spliterator(), false).collect(java.util.stream.Collectors.joining($separator$)) | |
java.util.stream.Stream → $expr$.collect(java.util.stream.Collectors.joining($separator$)) | |
.mkString : joins strings/elements together | |
ARRAY → java.util.Arrays.stream($expr$).collect(java.util.stream.Collectors.joining($separator$)) | |
java.util.Collection → $expr$.stream().collect(java.util.stream.Collectors.joining($separator$)) | |
java.lang.Iterable → java.util.stream.StreamSupport.stream($expr$.spliterator(), false).collect(java.util.stream.Collectors.joining($separator$)) | |
java.util.stream.Stream → $expr$.collect(java.util.stream.Collectors.joining($separator$)) | |
.map : map entries | |
java.util.List → $expr$.stream().map(e -> $key$).collect(java.util.stream.Collectors.toList()) | |
java.util.Set → $expr$.stream().map($fVar:suggestShortVariableName()$ -> $fVar:suggestShortVariableName()$ -> $f$).collect(java.util.stream.Collectors.toSet()) | |
java.util.Map → $expr$.entrySet().stream().collect(java.util.stream.Collectors.toMap(e -> $key$, e -> $value$, (o1, o2) -> o1)) | |
.flatMap : flat map entries | |
java.util.List → $expr$.stream().flatMap($fVar:suggestShortVariableName()$ -> $fVar:suggestShortVariableName()$ -> $f$).collect(java.util.stream.Collectors.toList()) | |
java.util.Set → $expr$.stream().flatMap($fVar:suggestShortVariableName()$ -> $fVar:suggestShortVariableName()$ -> $f$).collect(java.util.stream.Collectors.toSet()) | |
.mapKeys : map keys | |
java.util.Map → $expr$.entrySet().stream().collect(java.util.stream.Collectors.toMap(e -> $key$, e -> e.getValue(), (o1, o2) -> o1)) | |
.mapValues : map values | |
java.util.Map → $expr$.entrySet().stream().collect(java.util.stream.Collectors.toMap(e -> e.getKey(), e -> $value$, (o1, o2) -> o1)) | |
.getOrElseUpdate : get or else update | |
java.util.Map → $expr$.computeIfAbsent($key$, e -> $value$) | |
.filter : filter map entries | |
java.util.List → $expr$.stream().filter($conditionVar:suggestShortVariableName()$ -> $condition$).collect(java.util.stream.Collectors.toList()) | |
java.util.Set → $expr$.stream().filter($conditionVar:suggestShortVariableName()$ -> $condition$).collect(java.util.stream.Collectors.toSet()) | |
java.util.Map → $expr$.entrySet().stream().filter($conditionVar:suggestShortVariableName()$ -> $condition$).collect(java.util.stream.Collectors.toMap(e -> e.getKey(), e -> e.getValue(), (o1, o2) -> o1)) | |
java.lang.Iterable → java.util.stream.StreamSupport.stream($expr$.spliterator(), false).collect(java.util.stream.Collectors.toList()) | |
.reduce : reduce | |
ARRAY → java.util.Arrays.stream($expr$).reduce((a, b) -> $accumulator$) | |
java.util.Collection → $expr$.stream().reduce((a, b) -> $accumulator$) | |
java.lang.Iterable → java.util.stream.StreamSupport.stream($expr$.spliterator(), false).reduce((a, b) -> $accumulator$) | |
.fold : fold | |
ARRAY → java.util.Arrays.stream($expr$).reduce($neutralElement$, (a, b) -> $accumulator$) | |
java.util.Collection → $expr$.stream().reduce($neutralElement$, (a, b) -> $accumulator$) | |
java.lang.Iterable → java.util.stream.StreamSupport.stream($expr$.spliterator(), false).reduce($neutralElement$, (a, b) -> $accumulator$) | |
java.util.stream.Stream → $expr$.reduce($neutralElement$, (a, b) -> $accumulator$) | |
.find : find element | |
ARRAY → java.util.Arrays.stream($expr$).filter($conditionVar:suggestShortVariableName()$ -> $condition$).findFirst() | |
java.util.Collection → $expr$.stream().filter($conditionVar:suggestShortVariableName()$ -> $condition$).findFirst() | |
java.lang.Iterable → java.util.stream.StreamSupport.stream($expr$.spliterator(), false).filter($conditionVar:suggestShortVariableName()$ -> $condition$).findFirst() | |
java.util.stream.Stream → $expr$.filter($conditionVar:suggestShortVariableName()$ -> $condition$).findFirst() | |
.take : take a certain number of elements | |
java.util.stream.Stream → $expr$.limit($intValue$) | |
.drop : drop a certain number of elements | |
java.util.stream.Stream → $expr$.skip($intValue$) | |
.size : size of collection | |
ARRAY → $expr$.length | |
.get : get element | |
ARRAY → $expr$[$i$] | |
.head : get first element | |
ARRAY → $expr$[0] | |
java.util.List → $expr$.get(0) | |
.first : get first element | |
ARRAY → $expr$[0] | |
java.util.List → $expr$.get(0) | |
.last : get last element | |
ARRAY → $expr$[$expr$.length-1] | |
java.util.List → $expr$.get($expr$.size()-1) | |
## Templates for slf4j-logger ## | |
.logDebug : log debug message | |
java.lang.String [org.slf4j.Logger] → $log*:variableOfType("org.slf4j.Logger"):"log"$.debug($expr$, $exception:variableOfType("java.lang.Throwable")$) | |
java.lang.Throwable [org.slf4j.Logger] → $log*:variableOfType("org.slf4j.Logger"):"log"$.debug("$message$", $expr$) | |
.logError : log error message | |
java.lang.String [org.slf4j.Logger] → $log*:variableOfType("org.slf4j.Logger"):"log"$.error($expr$, $exception:variableOfType("java.lang.Throwable")$) | |
java.lang.Throwable [org.slf4j.Logger] → $log*:variableOfType("org.slf4j.Logger"):"log"$.error("$message$", $expr$) | |
.logFatal : log fatal message | |
java.lang.String [org.slf4j.Logger] → $log*:variableOfType("org.slf4j.Logger"):"log"$.fatal($expr$, $exception:variableOfType("java.lang.Throwable")$) | |
java.lang.Throwable [org.slf4j.Logger] → $log*:variableOfType("org.slf4j.Logger"):"log"$.fatal("$message$", $expr$) | |
.logInfo : log info message | |
java.lang.String [org.slf4j.Logger] → $log*:variableOfType("org.slf4j.Logger"):"log"$.info($expr$, $exception:variableOfType("java.lang.Throwable")$) | |
java.lang.Throwable [org.slf4j.Logger] → $log*:variableOfType("org.slf4j.Logger"):"log"$.info("$message$", $expr$) | |
.logTrace : log trace message | |
java.lang.String [org.slf4j.Logger] → $log*:variableOfType("org.slf4j.Logger"):"log"$.trace($expr$, $exception:variableOfType("java.lang.Throwable")$) | |
java.lang.Throwable [org.slf4j.Logger] → $log*:variableOfType("org.slf4j.Logger"):"log"$.trace("$message$", $expr$) | |
.logWarn : log warn message | |
java.lang.String [org.slf4j.Logger] → $log*:variableOfType("org.slf4j.Logger"):"log"$.warn($expr$, $exception:variableOfType("java.lang.Throwable")$) | |
java.lang.Throwable [org.slf4j.Logger] → $log*:variableOfType("org.slf4j.Logger"):"log"$.warn("$message$", $expr$) | |
## Templates for assertj ## | |
.assertThat : assertj-core assertThat | |
io.vavr.Lazy → [SKIP] | |
io.vavr.control.Either → [SKIP] | |
io.vavr.control.Validation → [SKIP] | |
io.vavr.control.Option → [SKIP] | |
io.vavr.control.Try → [SKIP] | |
io.vavr.collection.Seq → [SKIP] | |
io.vavr.collection.Map → [SKIP] | |
ANY [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.assertThat($expr$) [USE_STATIC_IMPORTS] | |
.assertCall : assertj-core assertCall | |
ANY [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.assertThatCode(() -> $expr$) [USE_STATIC_IMPORTS] | |
.assertEqualTo : assertj-core assertEqualTo | |
ANY [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.assertThat($expr$).isEqualTo($other$)$END$ [USE_STATIC_IMPORTS] | |
.assertNull : assertj-core assertNull | |
ANY [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.assertThat($expr$).isNull() [USE_STATIC_IMPORTS] | |
.assertNotNull : assertj-core assertNotNull | |
ANY [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.assertThat($expr$).isNotNull() [USE_STATIC_IMPORTS] | |
.assertBlank : assertj-core assertBlank | |
java.lang.String [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.assertThat($expr$).isBlank() [USE_STATIC_IMPORTS] | |
.assertNotBlank : assertj-core assertNotBlank | |
java.lang.String [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.assertThat($expr$).isNotBlank() [USE_STATIC_IMPORTS] | |
.assertTrue : assertj-core assertTrue | |
BOOLEAN [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.assertThat($expr$).isTrue() [USE_STATIC_IMPORTS] | |
.assertFalse : assertj-core assertFalse | |
BOOLEAN [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.assertThat($expr$).isFalse() [USE_STATIC_IMPORTS] | |
.assertEmpty : assertj-core assertEmpty | |
ARRAY [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.assertThat($expr$).isEmpty() [USE_STATIC_IMPORTS] | |
java.util.Map [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.assertThat($expr$).isEmpty() [USE_STATIC-IMPORTS] | |
java.lang.Iterable [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.assertThat($expr$).isEmpty() [USE_STATIC-IMPORTS] | |
.assertNotEmpty : assertj-core assertNotEmpty | |
ARRAY [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.assertThat($expr$).isNotEmpty() [USE_STATIC_IMPORTS] | |
java.util.Map [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.assertThat($expr$).isNotEmpty() [USE_STATIC_IMPORTS] | |
java.lang.Iterable [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.assertThat($expr$).isNotEmpty() [USE_STATIC_IMPORTS] | |
.assertThrowException : assertj-core assertThrowException | |
ANY [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.assertThatThrownBy(() -> $expr$) [USE_STATIC_IMPORTS] | |
.assertNotThrowException : assertj-core assertNotThrowException | |
ANY [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.assertThatCode(() -> $expr$).doesNotThrowAnyException() [USE_STATIC_IMPORTS] | |
.catchThrowable : assertj-core catchThrowable | |
ANY [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.catchThrowable(() -> $expr$) [USE_STATIC_IMPORTS] | |
.catchException : assertj-core catchException | |
ANY [org.assertj.core.api.Assertions] → org.assertj.core.api.Assertions.catchException(() -> $expr$) [USE_STATIC_IMPORTS] | |
## Templates for JUnit 5 jupiter ## | |
## Assert | |
## skip assertLinesMatch, assertAll, assertTimesout, assertTimeoutPreemptively | |
.fail : fail | |
java.lang.String [org.junit.jupiter.api.Assertions] → org.junit.jupiter.api.Assertions.fail($expr$) | |
.assertTrue : assertTrue | |
java.lang.Boolean [org.junit.jupiter.api.Assertions] → org.junit.jupiter.api.Assertions.assertTrue($expr$) | |
.assertFalse : assertFalse | |
java.lang.Boolean [org.junit.jupiter.api.Assertions] → org.junit.jupiter.api.Assertions.assertFalse($expr$) | |
.assertNull : assertNull | |
ANY [org.junit.jupiter.api.Assertions] → org.junit.jupiter.api.Assertions.assertNull($expr$) | |
.assertNotNull : assertNotNull | |
ANY [org.junit.jupiter.api.Assertions] → org.junit.jupiter.api.Assertions.assertNotNull($expr$) | |
.assertSame : assertSame | |
ANY [org.junit.jupiter.api.Assertions] → org.junit.jupiter.api.Assertions.assertSame($args$, $expr$) | |
.assertNotSame : assertNotSame | |
ANY [org.junit.jupiter.api.Assertions] → org.junit.jupiter.api.Assertions.assertNotSame($args$, $expr$) | |
.assertEquals : assertEquals | |
ANY [org.junit.jupiter.api.Assertions] → org.junit.jupiter.api.Assertions.assertEquals($args$, $expr$) | |
.assertNotEquals : assertNotEquals | |
ANY [org.junit.jupiter.api.Assertions] → org.junit.jupiter.api.Assertions.assertNotEquals($args$, $expr$) | |
.assertThrows : assertThrows | |
ANY [org.junit.jupiter.api.Assertions] → org.junit.jupiter.api.Assertions.assertThrows($expr$, $args$) | |
.assertDoesNotThrow : assertDoesNotThrow | |
ANY [org.junit.jupiter.api.Assertions] → org.junit.jupiter.api.Assertions.assertDoesNotThrow($expr$, $args$) | |
.assertArrayEquals : assertEquals | |
ARRAY [org.junit.jupiter.api.Assertions] → org.junit.jupiter.api.Assertions.assertArrayEquals($args$, $expr$) | |
.assertIterableEquals : assertIterableEquals | |
java.lang.Iterable [org.junit.jupiter.api.Assertions] → org.junit.jupiter.api.Assertions.assertIterableEquals($args$, $expr$) | |
# Mockito postfix templates | |
# create mock instance | |
.mock : mockito mock | |
java.lang.Class [org.mockito.Mockito] → org.mockito.Mockito.mock($expr$) [USE_STATIC_IMPORTS] | |
.mockWithName : mockito mockWithName | |
java.lang.Class [org.mockito.Mockito] → org.mockito.Mockito.mock($expr$, $name$) [USE_STATIC_IMPORTS] | |
.mockWithAnswer : mockito mockWithAnswer | |
java.lang.Class [org.mockito.Mockito] → org.mockito.Mockito.mock($expr$, (org.mockito.stubbing.Answer<$answerType$>) invocation -> $answerBody$) [USE_STATIC_IMPORTS] | |
# create spy instance | |
.spy : mockito spy | |
java.lang.Object [org.mockito.Mockito] → org.mockito.Mockito.spy($expr$) [USE_STATIC_IMPORTS] | |
# mockito stubing operations | |
.when : mockito when | |
NON_VOID [org.mockito.Mockito] → org.mockito.Mockito.when($expr$) [USE_STATIC_IMPORTS] | |
.verify : mockito verify | |
ANY [org.mockito.Mockito] → org.mockito.Mockito.verify($expr$) [USE_STATIC_IMPORTS] | |
.verifyWithMode : mockito verifyWithMode | |
ANY [org.mockito.Mockito] → org.mockito.Mockito.verify($expr$,$mode$) [USE_STATIC_IMPORTS] | |
.reset : mockito reset | |
ANY [org.mockito.Mockito] → org.mockito.Mockito.reset($expr$); [USE_STATIC_IMPORTS] | |
.clearInvocations : mockito clearInvocations | |
ANY [org.mockito.Mockito] → org.mockito.Mockito.clearInvocations($expr$); [USE_STATIC_IMPORTS] | |
.doThrow : mockito doThrow | |
ANY [org.mockito.Mockito] → org.mockito.Mockito.doThrow($throwable$).when($expr$).$END$ [USE_STATIC_IMPORTS] | |
.doNothing : mockito doNothing | |
ANY [org.mockito.Mockito] → org.mockito.Mockito.doNothing().when($expr$).$END$ [USE_STATIC_IMPORTS] | |
.doAnswer : mockito doAnswer | |
ANY [org.mockito.Mockito] → org.mockito.Mockito.doAnswer((org.mockito.stubbing.Answer<$answerType$>) invocation -> $answerBody$).when($expr$).$END$ [USE_STATIC_IMPORTS] | |
.doReturn : mockito doReturn | |
ANY [org.mockito.Mockito] → org.mockito.Mockito.doReturn($returnValue$).when($expr$).$END$ [USE_STATIC_IMPORTS] | |
.initMockito : mockito initMockito | |
ANY [org.mockito.Mockito] → org.mockito.MockitoAnnotations.initMocks($expr$); | |
# BDDMockito postfix templates from https://github.com/krrrr38/intellij-mockito-postfix-plugin | |
.given : BDDMockito given | |
java.lang.Class [org.mockito.BDDMockito] → org.mockito.BDDMockito.given($expr$)$END$ [USE_STATIC_IMPORTS] | |
.then : BDDMockito then | |
java.lang.Class [org.mockito.BDDMockito] → org.mockito.BDDMockito.then($expr$)$END$ [USE_STATIC_IMPORTS] | |
.will : BDDMockito will | |
NON_VOID [org.mockito.BDDMockito] → org.mockito.BDDMockito.will($answer$).given($expr$)$END$ [USE_STATIC_IMPORTS] | |
.willAnswer : BDDMockito willAnswer | |
NON_VOID [org.mockito.BDDMockito] → org.mockito.BDDMockito.willAnswer($answer$).given($expr$).$END$ [USE_STATIC_IMPORTS] | |
.willDoNothing : BDDMockito willDoNothing | |
NON_VOID [org.mockito.BDDMockito] → org.mockito.BDDMockito.willDoNothing().given($expr$)$END$ [USE_STATIC_IMPORTS] | |
.willReturn : BDDMockito willReturn | |
NON_VOID [org.mockito.BDDMockito] → org.mockito.BDDMockito.willReturn($return$).given($expr$)$END$ [USE_STATIC_IMPORTS] | |
.willThrow : BDDMockito willThrow | |
NON_VOID [org.mockito.BDDMockito] → org.mockito.BDDMockito.willThrow($ex$).given($expr$)$END$ [USE_STATIC_IMPORTS] | |
.willCallRealMethod : BDDMockito willCallRealMethod | |
NON_VOID [org.mockito.BDDMockito] → org.mockito.BDDMockito.willCallRealMethod().given($expr$)$END$ [USE_STATIC_IMPORTS] | |
# Templates for guava string utils ref: https://github.com/google/guava/wiki/StringsExplained | |
.join : guava joining together a sequence of strings with a separator | |
ARRAY [com.google.common.base.Joiner] → com.google.common.base.Joiner.on($separator$).join($expr$) | |
java.lang.Iterable [com.google.common.base.Joiner] → com.google.common.base.Joiner.on($separator$).join($expr$) | |
java.util.Map [com.google.common.base.Joiner] → com.google.common.base.Joiner.on($separator$).withKeyValueSeparator($keyValueSeparator$).useForNull($nullReplacement$).join($expr$) | |
.joinSkipNulls : guava joining together a sequence of strings with a separator and skip null values | |
ARRAY [com.google.common.base.Joiner] → com.google.common.base.Joiner.on($separator$).skipNulls().join($expr$) | |
java.lang.Iterable [com.google.common.base.Joiner] → com.google.common.base.Joiner.on($separator$).skipNulls().join($expr$) | |
.joinReplaceNull : guava joining together a sequence of strings with a separator and replace null values | |
ARRAY [com.google.common.base.Joiner] → com.google.common.base.Joiner.on($separator$).useForNull($nullReplacement$).join($expr$) | |
java.lang.Iterable [com.google.common.base.Joiner] → com.google.common.base.Joiner.on($separator$).useForNull($nullReplacement$).join($expr$) | |
java.util.Map [com.google.common.base.Joiner] → com.google.common.base.Joiner.on($separator$).withKeyValueSeparator($keyValueSeparator$).useForNull($nullReplacement$).join($expr$) | |
# split to array | |
.split : guava splitting strings with a separator | |
java.lang.String [com.google.common.base.Splitter] → com.google.common.base.Splitter.on($separator$).trimResults().omitEmptyStrings().split($expr$) | |
.splitByRegexp : guava splitting strings with a regexp pattern | |
java.lang.String [com.google.common.base.Splitter] → com.google.common.base.Splitter.onPattern($regexp$).trimResults().omitEmptyStrings().split($expr$) | |
.splitToFixedLength : guava splitting strings into substrings of the specified fixed length | |
java.lang.String [com.google.common.base.Splitter] → com.google.common.base.Splitter.fixedLength($length$).split($expr$) | |
.splitWithLimitSize : guava splitting strings into substrings with result size limited | |
java.lang.String [com.google.common.base.Splitter] → com.google.common.base.Splitter.on($separator$).limit($size$).split($expr$) | |
# split to list | |
.splitToList : guava splitting strings to list with a separator | |
java.lang.String [com.google.common.base.Splitter] → com.google.common.base.Splitter.on($separator$).trimResults().omitEmptyStrings().splitToList($expr$) | |
.splitToListByRegexp : guava splitting strings to list with a regexp pattern | |
java.lang.String [com.google.common.base.Splitter] → com.google.common.base.Splitter.onPattern($regexp$).trimResults().omitEmptyStrings().splitToList($expr$) | |
.splitToListWithFixedLength : guava splitting strings into list of substrings of the specified fixed length | |
java.lang.String [com.google.common.base.Splitter] → com.google.common.base.Splitter.fixedLength($length$).splitToList($expr$) | |
.splitToListWithLimitSize : guava splitting strings into list of substrings with result size limited | |
java.lang.String [com.google.common.base.Splitter] → com.google.common.base.Splitter.on($separator$).limit($size$).splitToList($expr$) | |
# split to map | |
.splitToMap : guava splitting strings to map with a separator | |
java.lang.String [com.google.common.base.Splitter] → com.google.common.base.Splitter.on($separator$).trimResults().omitEmptyStrings().withKeyValueSeparator($keyValueSeparator$).split($expr$) | |
.splitToMapByRegexp : guava splitting strings to map with a regexp pattern | |
java.lang.String [com.google.common.base.Splitter] → com.google.common.base.Splitter.onPattern($regexp$).trimResults().omitEmptyStrings().withKeyValueSeparator($keyValueSeparator$).split($expr$) | |
# Strings.repeat | |
.repeat : returns a string consisting of a specific number of concatenated copies of an input string | |
java.lang.String [com.google.common.base.Strings] → com.google.common.base.Strings.repeat($expr$, $times$) | |
# Strings.padding | |
.padStart : padding the start of a string with a padding char | |
java.lang.String [com.google.common.base.Strings] → com.google.common.base.Strings.padStart($expr$, $minLength$, $padChar$) | |
.padEnd : padding the end of a string with a padding char | |
java.lang.String [com.google.common.base.Strings] → com.google.common.base.Strings.padEnd($expr$, $minLength$, $padChar$) | |
# Strings null empty convert | |
.nullToEmpty : returns the given string if it is non-null; the empty string otherwise | |
java.lang.String [com.google.common.base.Strings] → com.google.common.base.Strings.nullToEmpty($expr$) | |
.emptyToNull : returns the given string if it is nonempty null otherwise | |
java.lang.String [com.google.common.base.Strings] → com.google.common.base.Strings.emptyToNull($expr$) | |
# CharMatcher.breakingWhitespace() | |
.formatToOneLine : format multiple lines text to on one line with a space | |
java.lang.String [com.google.common.base.CharMatcher] → com.google.common.base.CharMatcher.breakingWhitespace().replaceFrom($expr$, ' ') | |
# CharMatcher.whitespace() | |
.removeExtraWhitespace : remove multiple consecutive tabs and spaces and collapse them into single spaces | |
java.lang.String [com.google.common.base.CharMatcher] → com.google.common.base.CharMatcher.whitespace().trimAndCollapseFrom($expr$, ' ') | |
.removeWhitespace : remove all white space from the string | |
java.lang.String [com.google.common.base.CharMatcher] → com.google.common.base.CharMatcher.whitespace().removeFrom($expr$) | |
.trimWhitespace : remove leading and trailing whitespace | |
java.lang.String [com.google.common.base.CharMatcher] → com.google.common.base.CharMatcher.whitespace().trimFrom($expr$) | |
.replaceWhitespace : replace white space | |
java.lang.String [com.google.common.base.CharMatcher] → com.google.common.base.CharMatcher.whitespace().replaceFrom($expr$, $replace$) | |
## number conversions ## | |
.toBoolean : convert to boolean | |
java.lang.String → Boolean.parseBoolean($expr$) | |
.toByte : convert to byte | |
java.lang.String → Byte.parseByte($expr$) | |
java.lang.Number → $expr$.byteValue() | |
NUMBER → ((byte) ($expr$)) | |
.toShort : convert to short | |
java.lang.String → Short.parseShort($expr$) | |
java.lang.Number → $expr$.shortValue() | |
NUMBER → ((short) ($expr$)) | |
.toChar : convert to char | |
java.lang.String → $expr$.charAt(0) | |
NUMBER → ((char) ($expr$)) | |
.toInt : convert to int | |
java.lang.String → Integer.parseInt($expr$) | |
java.lang.Number → $expr$.intValue() | |
NUMBER → ((int) ($expr$)) | |
.toLong : convert to long | |
java.lang.String → Long.parseLong($expr$) | |
java.lang.Number → $expr$.longValue() | |
NUMBER → ((long) ($expr$)) | |
.toFloat : convert to float | |
java.lang.String → Float.parseFloat($expr$) | |
java.lang.Number → $expr$.floatValue() | |
NUMBER → ((float) ($expr$)) | |
.toDouble : convert to double | |
java.lang.String → Double.parseDouble($expr$) | |
java.lang.Number → $expr$.doubleValue() | |
NUMBER → ((double) ($expr$)) | |
.toBigDecimal : convert to BigDecimal | |
java.lang.String → new java.math.BigDecimal($expr$) | |
java.lang.Number → new java.math.BigDecimal($expr$) | |
NUMBER → new java.math.BigDecimal($expr$) | |
.format : format number | |
BYTE → String.format("$format::"%d"$", $expr$) | |
SHORT → String.format("$format::"%d"$", $expr$) | |
CHAR → String.format("$format::"%c"$", $expr$) | |
INT → String.format("$format::"%d"$", $expr$) | |
LONG → String.format("$format::"%d"$", $expr$) | |
FLOAT → String.format("$format::"%f"$", $expr$) | |
DOUBLE → String.format("$format::"%f"$", $expr$) | |
java.lang.String → String.format($expr$, $END$) | |
## function applications ## | |
.apply : apply the function | |
java.lang.Runnable → $expr$.run() | |
java.util.function.Supplier → $expr$.get() | |
java.util.function.BooleanSupplier → $expr$.getAsBoolean() | |
java.util.function.DoubleSupplier → $expr$.getAsDouble() | |
java.util.function.IntSupplier → $expr$.getAsInt() | |
java.util.function.LongSupplier → $expr$.getAsLong() | |
java.util.function.Consumer → $expr$.accept($object$) | |
java.util.function.BiConsumer → $expr$.accept($object$, $object$) | |
java.util.function.DoubleConsumer → $expr$.accept($doubleValue$) | |
java.util.function.IntConsumer → $expr$.accept($intValue$) | |
java.util.function.LongConsumer → $expr$.accept($longValue$) | |
java.util.function.ObjDoubleConsumer → $expr$.accept($object$, $doubleValue$) | |
java.util.function.ObjIntConsumer → $expr$.accept($object$, $intValue$) | |
java.util.function.ObjLongConsumer → $expr$.accept($object$, $longValue$) | |
java.util.function.Predicate → $expr$.test($object$) | |
java.util.function.BiPredicate → $expr$.test($object$, $object$) | |
java.util.function.DoublePredicate → $expr$.test($doubleValue$) | |
java.util.function.IntPredicate → $expr$.test($intValue$) | |
java.util.function.LongPredicate → $expr$.test($longValue$) | |
## Templates for java.nio.file.Files ## | |
## Files | |
.readString : readString | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.readString($expr$, $arg$) | |
.find : find | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.find($expr$, $arg$) | |
.writeString : writeString | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.writeString($expr$, $arg$) | |
.isReadable : isReadable | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.isReadable($expr$) | |
.move : move | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.move($expr$, $arg$) | |
.setPosixFilePermissions : setPosixFilePermissions | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.setPosixFilePermissions($expr$, $arg$) | |
.getFileAttributeView : getFileAttributeView | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.getFileAttributeView($expr$, $arg$) | |
.isSymbolicLink : isSymbolicLink | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.isSymbolicLink($expr$) | |
.setAttribute : setAttribute | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.setAttribute($expr$, $arg$) | |
.size : size | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.size($expr$) | |
.newDirectoryStream : newDirectoryStream | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.newDirectoryStream($expr$, $arg$) | |
.newOutputStream : newOutputStream | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.newOutputStream($expr$, $arg$) | |
.isExecutable : isExecutable | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.isExecutable($expr$) | |
.readAllLines : readAllLines | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.readAllLines($expr$, $arg$) | |
.setOwner : setOwner | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.setOwner($expr$, $arg$) | |
.createDirectories : createDirectories | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.createDirectories($expr$, $arg$) | |
.readAllBytes : readAllBytes | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.readAllBytes($expr$) | |
.isHidden : isHidden | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.isHidden($expr$) | |
.deleteIfExists : deleteIfExists | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.deleteIfExists($expr$) | |
.isRegularFile : isRegularFile | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.isRegularFile($expr$, $arg$) | |
.walk : walk | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.walk($expr$, $arg$) | |
.readSymbolicLink : readSymbolicLink | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.readSymbolicLink($expr$) | |
.getPosixFilePermissions : getPosixFilePermissions | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.getPosixFilePermissions($expr$, $arg$) | |
.isDirectory : isDirectory | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.isDirectory($expr$, $arg$) | |
.createLink : createLink | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.createLink($expr$, $arg$) | |
.isWritable : isWritable | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.isWritable($expr$) | |
.newBufferedReader : newBufferedReader | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.newBufferedReader($expr$, $arg$) | |
.newBufferedWriter : newBufferedWriter | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.newBufferedWriter($expr$, $arg$) | |
.newByteChannel : newByteChannel | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.newByteChannel($expr$, $arg$) | |
.getLastModifiedTime : getLastModifiedTime | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.getLastModifiedTime($expr$, $arg$) | |
.getOwner : getOwner | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.getOwner($expr$, $arg$) | |
.exists : exists | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.exists($expr$, $arg$) | |
.createSymbolicLink : createSymbolicLink | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.createSymbolicLink($expr$, $arg$) | |
.delete : delete | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.delete($expr$) | |
.getAttribute : getAttribute | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.getAttribute($expr$, $arg$) | |
.setLastModifiedTime : setLastModifiedTime | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.setLastModifiedTime($expr$, $arg$) | |
.copy : copy | |
java.io.File [java.nio.file.Files] → java.nio.file.Files.copy($expr$.toPath(), $arg$) | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.copy($expr$, $arg$) | |
java.io.InputStream [java.nio.file.Files] → java.nio.file.Files.copy($expr$, $arg$) | |
.createDirectory : createDirectory | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.createDirectory($expr$, $arg$) | |
.walkFileTree : walkFileTree | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.walkFileTree($expr$, $arg$) | |
.createTempFile : createTempFile | |
java.lang.String [java.nio.file.Files] → java.nio.file.Files.createTempFile($expr$, $arg$) | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.createTempFile($expr$, $arg$) | |
.createTempDirectory : createTempDirectory | |
java.lang.String [java.nio.file.Files] → java.nio.file.Files.createTempDirectory($expr$, $arg$) | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.createTempDirectory($expr$, $arg$) | |
.probeContentType : probeContentType | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.probeContentType($expr$) | |
.newInputStream : newInputStream | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.newInputStream($expr$, $arg$) | |
.lines : lines | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.lines($expr$, $arg$) | |
.isSameFile : isSameFile | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.isSameFile($expr$, $arg$) | |
.getFileStore : getFileStore | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.getFileStore($expr$) | |
.readAttributes : readAttributes | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.readAttributes($expr$, $arg$) | |
.notExists : notExists | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.notExists($expr$, $arg$) | |
.write : write | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.write($expr$, $arg$) | |
.list : list | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.list($expr$) | |
.createFile : createFile | |
java.nio.file.Path [java.nio.file.Files] → java.nio.file.Files.createFile($expr$, $arg$) | |
## I/O ## | |
.toFile : get file | |
java.lang.String → new java.io.File($expr$) | |
.toURL : get URL | |
java.lang.String → new java.net.URL($expr$) | |
.toURI : get URI | |
java.lang.String → new java.net.URI($expr$) | |
.lines : get lines | |
java.io.File → java.nio.file.Files.readAllLines($expr$.toPath(), java.nio.charset.Charset.forName($encoding::"\"UTF-8\""$)) | |
java.nio.file.Path → java.nio.file.Files.readAllLines($expr$, java.nio.charset.Charset.forName($encoding::"\"UTF-8\""$)) | |
java.lang.String → $expr$.split("\\r?\\n") | |
java.io.InputStream → new java.io.BufferedReader(new java.io.InputStreamReader($expr$)).lines() | |
.content : get content | |
java.io.File → new String(java.nio.file.Files.readAllBytes($expr$.toPath()), $encoding::"\"UTF-8\""$) | |
java.nio.file.Path → new String(java.nio.file.Files.readAllBytes($expr$), $encoding::"\"UTF-8\""$) | |
java.io.InputStream → new java.util.Scanner($expr$, $encoding::"\"UTF-8\""$).useDelimiter("\\\\A").next() | |
java.net.URL → new java.util.Scanner($expr$.openStream(), $encoding::"\"UTF-8\""$).useDelimiter("\\\\A").next() | |
.inputStream : get input stream | |
ARRAY → new java.io.ByteArrayInputStream($expr$) | |
java.lang.String → new java.io.ByteArrayInputStream($expr$.getBytes()) | |
java.io.File → new java.io.FileInputStream($expr$) | |
java.net.URL → $expr$.openStream() | |
.outputStream : get output stream | |
java.io.File → new java.io.FileOutputStream($expr$) | |
.bufferedReader : get BufferedReader | |
java.io.File → new java.io.BufferedReader(new java.io.FileReader($expr$)) | |
java.io.InputStream → new java.io.BufferedReader(new java.io.InputStreamReader($expr$)) | |
java.net.URL → new java.io.BufferedReader(new java.io.InputStreamReader($expr$.openStream())) | |
.bufferedWriter : get BufferedWriter | |
java.io.File → new java.io.BufferedWriter(new java.io.FileWriter($expr$)) | |
java.io.OutputStream → new java.io.BufferedWriter(new java.io.OutputStreamWriter($expr$)) | |
.printStream : get PrintStream | |
java.io.File → new java.io.PrintStream($expr$) | |
java.io.OutputStream → new java.io.PrintStream($expr$) | |
#.sout : print variable to System.out | |
# ARRAY → System.out.println(java.util.Arrays.toString($expr$)) | |
# NON_VOID → System.out.println($expr$) | |
.soutv : print variable to System.out | |
ARRAY → System.out.println("$escapedExpr*:escapeString(expr)$ = " + java.util.Arrays.toString($expr$)); | |
NON_VOID → System.out.println("$escapedExpr*:escapeString(expr)$ = " + $expr$); | |
.run : run shell command | |
java.lang.String → java.lang.Runtime.getRuntime().exec($expr$) | |
## misc ## | |
.new : new instance | |
CLASS → new $expr$($END$) | |
.val : final T name = expr | |
NON_VOID → final $type*:expressionType(expr))$ $var:suggestVariableName()$ = $expr$; | |
.vall : lombok.val name = expr | |
NON_VOID [lombok.val] → lombok.val $var:suggestVariableName()$ = $expr$; | |
.varl : lombok.var name = expr | |
NON_VOID [lombok.var] → lombok.var $var:suggestVariableName()$ = $expr$; | |
.orElse : or else | |
NON_VOID → Optional.ofNullable($expr$).orElse($value$) | |
.orElseGet : or else get | |
NON_VOID → Optional.ofNullable($expr$).orElseGet(() -> $supplier$) | |
.elvis : a ? a : b | |
NON_VOID → $expr$ != null ? $expr$ : $END$ | |
## String templates ## | |
.r : compile pattern | |
java.lang.String → java.util.regex.Pattern.compile($expr$) | |
.regEx : compile pattern | |
java.lang.String → java.util.regex.Pattern.compile($expr$) | |
.capitalize : capitalize first character | |
java.lang.String → $expr$.substring(0, 1).toUpperCase() + $expr$.substring(1) | |
.uncapitalize : uncapitalize first character | |
java.lang.String → $expr$.substring(0, 1).toLowerCase() + $expr$.substring(1) | |
## Date templates ## | |
.toDate : to Date | |
java.time.LocalDate → java.util.Date.from($expr$.atStartOfDay().atZone($zone::"ZoneId.systemDefault()"$).toInstant()) | |
java.time.LocalTime → java.util.Date.from($expr$.atDate($date$).atZone($zone::"ZoneId.systemDefault()"$).toInstant()) | |
java.time.LocalDateTime → java.util.Date.from($expr$.atZone($zone::"ZoneId.systemDefault()"$).toInstant()) | |
.toLocalDate : to LocalDate | |
java.util.Date → $expr$.toInstant().atZone($zone::"ZoneId.systemDefault()"$).toLocalDate() | |
.toLocalTime : to LocalTime | |
java.util.Date → $expr$.toInstant().atZone($zone::"ZoneId.systemDefault()"$).toLocalTime() | |
.toLocalDateTime : to LocalDateTime | |
java.util.Date → $expr$.toInstant().atZone($zone::"ZoneId.systemDefault()"$).toLocalDateTime() | |
## Templates for java.lang.Math ## | |
## Math | |
.fma : fma | |
FLOAT [java.lang.Math] → java.lang.Math.fma($expr$, $arg$) | |
DOUBLE [java.lang.Math] → java.lang.Math.fma($expr$, $arg$) | |
.multiplyFull : multiplyFull | |
INT [java.lang.Math] → java.lang.Math.multiplyFull($expr$, $arg$) | |
.sinh : sinh | |
DOUBLE [java.lang.Math] → java.lang.Math.sinh($expr$) | |
.negateExact : negateExact | |
LONG [java.lang.Math] → java.lang.Math.negateExact($expr$) | |
INT [java.lang.Math] → java.lang.Math.negateExact($expr$) | |
.toDegrees : toDegrees | |
DOUBLE [java.lang.Math] → java.lang.Math.toDegrees($expr$) | |
.expm1 : expm1 | |
DOUBLE [java.lang.Math] → java.lang.Math.expm1($expr$) | |
.getExponent : getExponent | |
FLOAT [java.lang.Math] → java.lang.Math.getExponent($expr$) | |
DOUBLE [java.lang.Math] → java.lang.Math.getExponent($expr$) | |
.asin : asin | |
DOUBLE [java.lang.Math] → java.lang.Math.asin($expr$) | |
.nextAfter : nextAfter | |
FLOAT [java.lang.Math] → java.lang.Math.nextAfter($expr$, $arg$) | |
DOUBLE [java.lang.Math] → java.lang.Math.nextAfter($expr$, $arg$) | |
.multiplyExact : multiplyExact | |
LONG [java.lang.Math] → java.lang.Math.multiplyExact($expr$, $arg$) | |
INT [java.lang.Math] → java.lang.Math.multiplyExact($expr$, $arg$) | |
.floorMod : floorMod | |
LONG [java.lang.Math] → java.lang.Math.floorMod($expr$, $arg$) | |
INT [java.lang.Math] → java.lang.Math.floorMod($expr$, $arg$) | |
.log10 : log10 | |
DOUBLE [java.lang.Math] → java.lang.Math.log10($expr$) | |
.min : min | |
FLOAT [java.lang.Math] → java.lang.Math.min($expr$, $arg$) | |
LONG [java.lang.Math] → java.lang.Math.min($expr$, $arg$) | |
INT [java.lang.Math] → java.lang.Math.min($expr$, $arg$) | |
DOUBLE [java.lang.Math] → java.lang.Math.min($expr$, $arg$) | |
.multiplyHigh : multiplyHigh | |
LONG [java.lang.Math] → java.lang.Math.multiplyHigh($expr$, $arg$) | |
.subtractExact : subtractExact | |
LONG [java.lang.Math] → java.lang.Math.subtractExact($expr$, $arg$) | |
INT [java.lang.Math] → java.lang.Math.subtractExact($expr$, $arg$) | |
.cos : cos | |
DOUBLE [java.lang.Math] → java.lang.Math.cos($expr$) | |
.exp : exp | |
DOUBLE [java.lang.Math] → java.lang.Math.exp($expr$) | |
.hypot : hypot | |
DOUBLE [java.lang.Math] → java.lang.Math.hypot($expr$, $arg$) | |
.cbrt : cbrt | |
DOUBLE [java.lang.Math] → java.lang.Math.cbrt($expr$) | |
.atan : atan | |
DOUBLE [java.lang.Math] → java.lang.Math.atan($expr$) | |
.pow : pow | |
DOUBLE [java.lang.Math] → java.lang.Math.pow($expr$, $arg$) | |
.ceil : ceil | |
DOUBLE [java.lang.Math] → java.lang.Math.ceil($expr$) | |
.nextDown : nextDown | |
FLOAT [java.lang.Math] → java.lang.Math.nextDown($expr$) | |
DOUBLE [java.lang.Math] → java.lang.Math.nextDown($expr$) | |
.rint : rint | |
DOUBLE [java.lang.Math] → java.lang.Math.rint($expr$) | |
.log1p : log1p | |
DOUBLE [java.lang.Math] → java.lang.Math.log1p($expr$) | |
.max : max | |
FLOAT [java.lang.Math] → java.lang.Math.max($expr$, $arg$) | |
LONG [java.lang.Math] → java.lang.Math.max($expr$, $arg$) | |
INT [java.lang.Math] → java.lang.Math.max($expr$, $arg$) | |
DOUBLE [java.lang.Math] → java.lang.Math.max($expr$, $arg$) | |
.toIntExact : toIntExact | |
LONG [java.lang.Math] → java.lang.Math.toIntExact($expr$) | |
.atan2 : atan2 | |
DOUBLE [java.lang.Math] → java.lang.Math.atan2($expr$, $arg$) | |
.sqrt : sqrt | |
DOUBLE [java.lang.Math] → java.lang.Math.sqrt($expr$) | |
.copySign : copySign | |
FLOAT [java.lang.Math] → java.lang.Math.copySign($expr$, $arg$) | |
DOUBLE [java.lang.Math] → java.lang.Math.copySign($expr$, $arg$) | |
.floor : floor | |
DOUBLE [java.lang.Math] → java.lang.Math.floor($expr$) | |
.incrementExact : incrementExact | |
LONG [java.lang.Math] → java.lang.Math.incrementExact($expr$) | |
INT [java.lang.Math] → java.lang.Math.incrementExact($expr$) | |
.IEEEremainder : IEEEremainder | |
DOUBLE [java.lang.Math] → java.lang.Math.IEEEremainder($expr$, $arg$) | |
.addExact : addExact | |
LONG [java.lang.Math] → java.lang.Math.addExact($expr$, $arg$) | |
INT [java.lang.Math] → java.lang.Math.addExact($expr$, $arg$) | |
.toRadians : toRadians | |
DOUBLE [java.lang.Math] → java.lang.Math.toRadians($expr$) | |
.floorDiv : floorDiv | |
LONG [java.lang.Math] → java.lang.Math.floorDiv($expr$, $arg$) | |
INT [java.lang.Math] → java.lang.Math.floorDiv($expr$, $arg$) | |
.tanh : tanh | |
DOUBLE [java.lang.Math] → java.lang.Math.tanh($expr$) | |
.round : round | |
FLOAT [java.lang.Math] → java.lang.Math.round($expr$) | |
DOUBLE [java.lang.Math] → java.lang.Math.round($expr$) | |
.cosh : cosh | |
DOUBLE [java.lang.Math] → java.lang.Math.cosh($expr$) | |
.tan : tan | |
DOUBLE [java.lang.Math] → java.lang.Math.tan($expr$) | |
.abs : abs | |
FLOAT [java.lang.Math] → java.lang.Math.abs($expr$) | |
LONG [java.lang.Math] → java.lang.Math.abs($expr$) | |
INT [java.lang.Math] → java.lang.Math.abs($expr$) | |
DOUBLE [java.lang.Math] → java.lang.Math.abs($expr$) | |
.sin : sin | |
DOUBLE [java.lang.Math] → java.lang.Math.sin($expr$) | |
.nextUp : nextUp | |
FLOAT [java.lang.Math] → java.lang.Math.nextUp($expr$) | |
DOUBLE [java.lang.Math] → java.lang.Math.nextUp($expr$) | |
.log : log | |
DOUBLE [java.lang.Math] → java.lang.Math.log($expr$) | |
.signum : signum | |
FLOAT [java.lang.Math] → java.lang.Math.signum($expr$) | |
DOUBLE [java.lang.Math] → java.lang.Math.signum($expr$) | |
.acos : acos | |
DOUBLE [java.lang.Math] → java.lang.Math.acos($expr$) | |
.scalb : scalb | |
FLOAT [java.lang.Math] → java.lang.Math.scalb($expr$, $arg$) | |
DOUBLE [java.lang.Math] → java.lang.Math.scalb($expr$, $arg$) | |
.ulp : ulp | |
FLOAT [java.lang.Math] → java.lang.Math.ulp($expr$) | |
DOUBLE [java.lang.Math] → java.lang.Math.ulp($expr$) | |
.decrementExact : decrementExact | |
LONG [java.lang.Math] → java.lang.Math.decrementExact($expr$) | |
INT [java.lang.Math] → java.lang.Math.decrementExact($expr$) | |
## Templates for methods ## | |
.isAbstract : isAbstract | |
java.lang.reflect.Method → java.lang.reflect.Modifier.isAbstract($expr$.getModifiers()) | |
.isFinal : isFinal | |
java.lang.reflect.Method → java.lang.reflect.Modifier.isFinal($expr$.getModifiers()) | |
java.lang.reflect.Field → java.lang.reflect.Modifier.isFinal($expr$.getModifiers()) | |
.isInterface : isInterface | |
java.lang.reflect.Method → java.lang.reflect.Modifier.isInterface($expr$.getModifiers()) | |
.isNative : isNative | |
java.lang.reflect.Method → java.lang.reflect.Modifier.isNative($expr$.getModifiers()) | |
.isPrivate : isPrivate | |
java.lang.reflect.Method → java.lang.reflect.Modifier.isPrivate($expr$.getModifiers()) | |
java.lang.reflect.Field → java.lang.reflect.Modifier.isPrivate($expr$.getModifiers()) | |
.isProtected : isProtected | |
java.lang.reflect.Method → java.lang.reflect.Modifier.isProtected($expr$.getModifiers()) | |
java.lang.reflect.Field → java.lang.reflect.Modifier.isProtected($expr$.getModifiers()) | |
.isPublic : isPublic | |
java.lang.reflect.Method → java.lang.reflect.Modifier.isPublic($expr$.getModifiers()) | |
java.lang.reflect.Field → java.lang.reflect.Modifier.isPublic($expr$.getModifiers()) | |
.isStatic : isStatic | |
java.lang.reflect.Method → java.lang.reflect.Modifier.isStatic($expr$.getModifiers()) | |
java.lang.reflect.Field → java.lang.reflect.Modifier.isStatic($expr$.getModifiers()) | |
.isStrict : isStrict | |
java.lang.reflect.Method → java.lang.reflect.Modifier.isStrict($expr$.getModifiers()) | |
.isSynchronized : isSynchronized | |
java.lang.reflect.Method → java.lang.reflect.Modifier.isSynchronized($expr$.getModifiers()) | |
.isTransient : isTransient | |
java.lang.reflect.Method → java.lang.reflect.Modifier.isTransient($expr$.getModifiers()) | |
java.lang.reflect.Field → java.lang.reflect.Modifier.isTransient($expr$.getModifiers()) | |
.isVolatile : isVolatile | |
java.lang.reflect.Method → java.lang.reflect.Modifier.isVolatile($expr$.getModifiers()) | |
java.lang.reflect.Field → java.lang.reflect.Modifier.isVolatile($expr$.getModifiers()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment