本文整理匯總了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;
}