Skip to content

Instantly share code, notes, and snippets.

@ihuangqi
Last active December 13, 2024 07:15
java.postfixTemplates
# https://github.com/xylo/intellij-postfix-templates
# =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
# https://www.jetbrains.com/help/idea/2023.2/edit-template-variables-dialog.html?utm_source=product&utm_medium=link&utm_campaign=IU&utm_content=2023.2#controls
#
# $type*:expressionType(expr))$
# $var:suggestVariableName()$
# $var:suggestVariableName()$
# $expr$
# $project:variableOfType("com.intellij.openapi.project.Project")$
# $ELEMENT_TYPE:iterableComponentType(expr):"java.lang.Object"$
# $TYPE:rightSideType():"Object"$ $VAR:suggestVariableName()$ = $CAST*:castToLeftSideType()$ $expr$.nextElement();\
#
# =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
#
# [IMPORT java.io.PrintStream]
# [USE_STATIC_IMPORTS]
#
# =*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
# https://gist.githubusercontent.com/ihuangqi/ddcb5abf44f45899b6bf8fc572528524/raw/java.postfixTemplates
.equals : 相等
java.lang.Object → Objects.equals($expr$, $END$)
.safe : Null转成空对象
java.util.List → ListUtils.emptyIfNull($expr$)$END$
java.util.Collection → CollectionUtils.emptyIfNull($expr$)$END$
.collect : 转换
java.util.Collection → CollectionUtils.collect($expr$, $method:suggestVariableName()$)
.isEmpty : 判断是否为空
java.lang.String → StringUtils.isEmpty($expr$)$END$
java.util.Collection → CollectionUtils.isEmpty($expr$)$END$
java.util.Map → MapUtils.isEmpty($expr$)$END$
ARRAY → ArrayUtils.isEmpty($expr$)$END$
.isNotEmpty : 判断是否不为空
java.lang.String → StringUtils.isNotEmpty($expr$)$END$
java.util.Collection → CollectionUtils.isNotEmpty($expr$)$END$
java.util.Map → MapUtils.isNotEmpty($expr$)$END$
ARRAY → ArrayUtils.isNotEmpty($expr$)$END$
.uniqueIndex: 转成Map
java.lang.Iterable → Maps.uniqueIndex($expr$, $ELEMENT_TYPE:iterableComponentType(expr)$::$END$)
.get : 获取
java.lang.Iterable → IterableUtils.get($expr$,$END$)
java.util.Map → CollectionUtils.get($expr$,$END$)
ARRAY → CollectionUtils.get($expr$,$END$)
.first : 第一个元素
java.lang.Iterable → IterableUtils.find($expr$,TruePredicate.truePredicate())
.select : 过滤集合
java.util.List → ListUtils.select($expr$, $ELEMENT_TYPE:iterableComponentType(expr)$::$END$)
java.util.Collection → CollectionUtils.select($expr$, $ELEMENT_TYPE:iterableComponentType(expr)$::$END$)
.filter : 转换
java.util.Collection → CollectionUtils.select($expr$,$type:completeSmart()$)
.size : 大小
java.util.Collection → CollectionUtils.size($expr$)$END$
java.util.Map → MapUtils.size($expr$)$END$
ARRAY → ArrayUtils.getLength($expr$)$END$
.converter : 转换
java.util.Collection → ConvertUtils.converter($expr$)$END$
.convert : 转换
java.util.Collection → ConvertUtils.convert($expr$,$type:completeSmart()$)
.copy : BeanUtils.copy
java.util.Collection [com.jcloud.boot.common.util.BeanUtils] → BeanUtils.copy($expr$,$type:completeSmart()$)
java.lang.Object → BeanUtils.copy($expr$,$type:completeSmart()$)
.option : WrapperUtils.option(wrapper)
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper -> WrapperUtils.option($expr$)$END$
.chinaUpdate : lambdaUpdateChain
com.baomidou.mybatisplus.core.mapper.BaseMapper [com.baomidou.mybatisplus.extension.toolkit.ChainWrappers] → ChainWrappers.lambdaUpdateChain($expr$).$END$
.chinaQuery : lambdaQueryChain
com.baomidou.mybatisplus.core.mapper.BaseMapper [com.baomidou.mybatisplus.extension.toolkit.ChainWrappers] → ChainWrappers.lambdaQueryChain($expr$).$END$
.toCode : ICode.toEnum
java.lang.Integer [com.jcloud.boot.common.specification.ICode] → ICode.toEnum($type:variableOfType("com.jcloud.boot.common.specification.ICode")$,$expr$)
java.lang.String [com.jcloud.boot.common.specification.ICode] → ICode.toEnum($type:variableOfType("com.jcloud.boot.common.specification.ICode")$,$expr$)
CLASS [com.jcloud.boot.common.specification.ICode] → ICode.toEnum($expr$.class,$END$)
.toDict : IDict.toEnum
java.lang.Integer [com.jcloud.boot.common.specification.IDict] → IDict.toEnum($type:variableOfType("com.jcloud.boot.common.specification.ICode")$,$expr$)
java.lang.String [com.jcloud.boot.common.specification.IDict] → IDict.toEnum($type:variableOfType("com.jcloud.boot.common.specification.ICode")$,$expr$)
CLASS [com.jcloud.boot.common.specification.IDict] → IDict.toEnum($expr$.class,$END$)
.in : lambdaQueryChain().in
java.util.Collection → if (CollectionUtils.isEmpty($expr$)) {\
return Collections.emptyList(); \
}\
ChainWrappers.lambdaQueryChain($mapper:variableOfType("com.baomidou.mybatisplus.core.mapper.BaseMapper")$).in($method:suggestVariableName()$,$expr$)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment