本文整理汇总了Java中com.intellij.psi.impl.light.LightMethod类的典型用法代码示例。如果您正苦于以下问题:Java LightMethod类的具体用法?Java LightMethod怎么用?Java LightMethod使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LightMethod类属于com.intellij.psi.impl.light包,在下文中一共展示了LightMethod类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: value
import com.intellij.psi.impl.light.LightMethod; //导入依赖的package包/类
@Override
public boolean value(PsiElement element) {
if (element instanceof LightMethod) {
PsiClass containingClass = ((LightMethod)element).getContainingClass();
if (containingClass != null && containingClass.isEnum()) return true;
}
if (element instanceof PsiReceiverParameter) {
return true;
}
return element instanceof PsiJavaFile &&
!FileTypeUtils.isInServerPageFile(element) &&
!JavaProjectRootsUtil.isOutsideJavaSourceRoot((PsiFile)element) &&
((PsiJavaFile) element).getClasses().length > 0;
}
示例2: getValuesMethod
import com.intellij.psi.impl.light.LightMethod; //导入依赖的package包/类
@Nullable
public PsiMethod getValuesMethod() {
PsiMethod method = myValuesMethod;
if (method == null && isEnum() && getName() != null) {
PsiElementFactory elementFactory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
final PsiMethod valuesMethod = elementFactory.createMethodFromText("public static " + getName() + "[] values() {}", this);
myValuesMethod = method = new LightMethod(getManager(), valuesMethod, this);
}
return method;
}
示例3: getValueOfMethod
import com.intellij.psi.impl.light.LightMethod; //导入依赖的package包/类
@Nullable
public PsiMethod getValueOfMethod() {
PsiMethod method = myValueOfMethod;
if (method == null && isEnum() && getName() != null) {
PsiElementFactory elementFactory = JavaPsiFacade.getInstance(getProject()).getElementFactory();
final PsiMethod valuesMethod = elementFactory.createMethodFromText("public static " + getName() + " valueOf(String name) throws IllegalArgumentException {}", this);
myValueOfMethod = method = new LightMethod(getManager(), valuesMethod, this);
}
return method;
}
示例4: getSyntheticMethod
import com.intellij.psi.impl.light.LightMethod; //导入依赖的package包/类
private PsiMethod getSyntheticMethod(String text) {
PsiElementFactory factory = JavaPsiFacade.getInstance(myClass.getProject()).getElementFactory();
PsiMethod method = factory.createMethodFromText(text, myClass);
return new LightMethod(myClass.getManager(), method, myClass);
}