本文整理汇总了Java中org.eclipse.gmt.modisco.java.MethodInvocation类的典型用法代码示例。如果您正苦于以下问题:Java MethodInvocation类的具体用法?Java MethodInvocation怎么用?Java MethodInvocation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MethodInvocation类属于org.eclipse.gmt.modisco.java包,在下文中一共展示了MethodInvocation类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: queryUnusedMethodsWithLoop
import org.eclipse.gmt.modisco.java.MethodInvocation; //导入依赖的package包/类
public static Query<Integer> queryUnusedMethodsWithLoop(Resource resource) {
return () -> {
List<MethodDeclaration> unusedMethods = new BasicEList<>();
Iterable<MethodInvocation> methodInvocations = getAllInstances(resource, JavaPackage.eINSTANCE.getMethodInvocation());
Iterable<MethodDeclaration> methodDeclarations = getAllInstances(resource, JavaPackage.eINSTANCE.getMethodDeclaration());
for (MethodDeclaration method : methodDeclarations) {
if (nonNull(method.getModifier())) {
if (method.getModifier().getVisibility() == VisibilityKind.PRIVATE) {
if (!hasBeenInvoked(methodInvocations, method)) {
unusedMethods.add(method);
}
}
}
}
return unusedMethods.size();
};
}
示例2: hasBeenInvoked
import org.eclipse.gmt.modisco.java.MethodInvocation; //导入依赖的package包/类
private static boolean hasBeenInvoked(Iterable<MethodInvocation> methodInvocations, EObject method) {
for (MethodInvocation methodInvocation : methodInvocations) {
if (Objects.equals(methodInvocation.getMethod(), method)) {
return true;
}
}
return false;
}
示例3: createCallMethodInstruction
import org.eclipse.gmt.modisco.java.MethodInvocation; //导入依赖的package包/类
/**
* Create a method call instruction from a caller
*
* @param caller
* the caller of the method.
* @param methodName
* the name of the method to call.
* @return the created method call instruction from the specified caller.
*/
public static AbstractMethodInstruction createCallMethodInstruction(IElementaryInstruction caller, String methodName) {
MethodDeclaration methodDeclaration = MethodDeclarationBuilder.builder().setName(methodName).build();
MethodInvocation methodInvocation = MethodInvocationBuilder.builder().setMethod(methodDeclaration)
.setExpression(caller.getExpression()).build();
return new AbstractMethodInstruction(methodInvocation);
}
示例4: AbstractMethodInstruction
import org.eclipse.gmt.modisco.java.MethodInvocation; //导入依赖的package包/类
/**
* Constructor of abstract method instruction
*
* @param methodInvocation
* the method invocation statement.
*/
public AbstractMethodInstruction(MethodInvocation methodInvocation) {
super(ExpressionStatementBuilder.builder().setExpression(methodInvocation).build());
this.abstractMethodInvocation = methodInvocation;
}
示例5: build
import org.eclipse.gmt.modisco.java.MethodInvocation; //导入依赖的package包/类
/**
* Build a method invocation of modisco model
*
* @return a new method invocation of modisco model.
*/
public MethodInvocation build() {
return this.buildMethodInvocation;
}