本文整理汇总了Java中com.intellij.refactoring.wrapreturnvalue.usageInfo.WrapReturnValue类的典型用法代码示例。如果您正苦于以下问题:Java WrapReturnValue类的具体用法?Java WrapReturnValue怎么用?Java WrapReturnValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WrapReturnValue类属于com.intellij.refactoring.wrapreturnvalue.usageInfo包,在下文中一共展示了WrapReturnValue类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitReturnStatement
import com.intellij.refactoring.wrapreturnvalue.usageInfo.WrapReturnValue; //导入依赖的package包/类
public void visitReturnStatement(PsiReturnStatement statement) {
super.visitReturnStatement(statement);
final PsiExpression returnValue = statement.getReturnValue();
if (myUseExistingClass && returnValue instanceof PsiMethodCallExpression) {
final PsiMethodCallExpression callExpression = (PsiMethodCallExpression)returnValue;
if (callExpression.getArgumentList().getExpressions().length == 0) {
final PsiReferenceExpression callMethodExpression = callExpression.getMethodExpression();
final String methodName = callMethodExpression.getReferenceName();
if (Comparing.strEqual(myUnwrapMethodName, methodName)) {
final PsiExpression qualifier = callMethodExpression.getQualifierExpression();
if (qualifier != null) {
final PsiType qualifierType = qualifier.getType();
if (qualifierType != null && qualifierType.getCanonicalText().equals(myQualifiedName)) {
usages.add(new ReturnWrappedValue(statement));
return;
}
}
}
}
}
usages.add(new WrapReturnValue(statement, type));
}
示例2: visitReturnStatement
import com.intellij.refactoring.wrapreturnvalue.usageInfo.WrapReturnValue; //导入依赖的package包/类
public void visitReturnStatement(PsiReturnStatement statement) {
super.visitReturnStatement(statement);
if (PsiTreeUtil.getParentOfType(statement, PsiMethod.class) != myMethod) return;
final PsiExpression returnValue = statement.getReturnValue();
if (myUseExistingClass && returnValue instanceof PsiMethodCallExpression) {
final PsiMethodCallExpression callExpression = (PsiMethodCallExpression)returnValue;
if (callExpression.getArgumentList().getExpressions().length == 0) {
final PsiReferenceExpression callMethodExpression = callExpression.getMethodExpression();
final String methodName = callMethodExpression.getReferenceName();
if (Comparing.strEqual(unwrapMethodName, methodName)) {
final PsiExpression qualifier = callMethodExpression.getQualifierExpression();
if (qualifier != null) {
final PsiType qualifierType = qualifier.getType();
if (qualifierType != null && qualifierType.getCanonicalText().equals(myQualifiedName)) {
usages.add(new ReturnWrappedValue(statement));
return;
}
}
}
}
}
usages.add(new WrapReturnValue(statement, type));
}