@Override public Boolean apply(final JvmOperation it) { return Boolean.valueOf(it.getSimpleName().startsWith("value")); } };
@Override public Boolean apply(final JvmOperation it) { String _simpleName = it.getSimpleName(); return Boolean.valueOf(Objects.equal(_simpleName, methodName)); } };
private static JvmOperation findOperation(JvmDeclaredType type, String operationName) { // For capacity call redirection for (final JvmOperation declaredOperation : type.getDeclaredOperations()) { if (declaredOperation.getSimpleName().equals(operationName)) { return declaredOperation; } } return null; }
/** * Returns true, if the given operation matches this dispatch signature and is therefore a case * for this dispatcher. */ public boolean isDispatchCase(JvmOperation operation) { return arity == operation.getParameters().size() && simpleName.equals(operation.getSimpleName()); }
public boolean isDispatchFunction(JvmOperation inferredOperation) { if (inferredOperation.getSimpleName() != null && inferredOperation.getSimpleName().startsWith("_")) { EObject sourceElement = associations.getPrimarySourceElement(inferredOperation); if (sourceElement instanceof XtendFunction) { XtendFunction function = (XtendFunction) sourceElement; if (function.isDispatch() && inferredOperation.getSimpleName().equals("_" + function.getName())) return true; return false; } } return false; }
public JvmOperation findSingleValueAttribute(JvmAnnotationType type) { Iterable<JvmOperation> operations = type.getDeclaredOperations(); for (JvmOperation operation : operations) { if (operation.getSimpleName().equals("value")) { return operation; } } return null; }
@Override public QualifiedName apply(final JvmOperation it) { QualifiedName _xifexpression = null; boolean _isGetterMethod = EmfParsleyDslScopeProvider.this.isGetterMethod(it.getSimpleName()); if (_isGetterMethod) { _xifexpression = QualifiedName.create(EmfParsleyDslScopeProvider.this.getPropertyNameForGetterMethod(it.getSimpleName())); } else { _xifexpression = null; } return _xifexpression; } };
@Override public void apply(final JvmOperation it) { String _simpleName = it.getSimpleName(); IEObjectDescription _generateDescription = ProtelisScopeProvider.generateDescription(_simpleName, it); destination.add(_generateDescription); String _qualifiedName = it.getQualifiedName(); String _replace = _qualifiedName.replace(".", "::"); IEObjectDescription _generateDescription_1 = ProtelisScopeProvider.generateDescription(_replace, it); destination.add(_generateDescription_1); } };
@Override public IEObjectDescription apply(JvmOperation from) { return EObjectDescription.create(QualifiedName.create(from.getSimpleName()), from); } });
@Override public String getValueName() { JvmOperation operation = getOperation(); if (operation == null || operation.eIsProxy()) return null; return operation.getSimpleName(); }
@Override public String getValueName() { JvmOperation operation = getOperation(); if (operation == null || operation.eIsProxy()) return null; return operation.getSimpleName(); }
@Override public Boolean apply(final JvmOperation it) { return Boolean.valueOf((it.getSimpleName().startsWith("bind") && (IterableExtensions.<JvmTypeReference>head(((JvmParameterizedTypeReference) it.getReturnType()).getArguments()) != null))); } };
protected String getExtensionSignature(IIdentifiableElementDescription desc) { JvmOperation operation = (JvmOperation) desc.getElementOrProxy(); StringBuilder builder = new StringBuilder(64).append(desc.getName()); String opName = operation.getSimpleName(); if (opName.length() - 3 == desc.getName().getFirstSegment().length() && opName.startsWith("set")) { builder.append("="); } appendParameters(operation, builder, desc.isExtension()); return builder.toString(); }
protected boolean remove(final JvmOperation op) { final Predicate<JvmAnnotationValue> _function = (JvmAnnotationValue it) -> { return (Objects.equal(op, it.getOperation()) || ((it.getOperation() == null) && Objects.equal(op.getSimpleName(), "value"))); }; return Iterators.<JvmAnnotationValue>removeIf(this.delegate.getExplicitValues().iterator(), _function); }
/** * Return the local cases that contribute to the given dispatch operation (in no particular order, but usually as defined in the file). */ public List<JvmOperation> getLocalDispatchCases(JvmOperation dispatcherOperation) { DispatchSignature dispatchSignature = new DispatchSignature(dispatcherOperation.getSimpleName(), dispatcherOperation.getParameters().size()); JvmDeclaredType type = dispatcherOperation.getDeclaringType(); return getLocalDispatchCases(type, dispatchSignature); }
public XExpression findValue(XAnnotation annotation, JvmOperation jvmOperation) { if (jvmOperation.getSimpleName().equals("value") && annotation.getValue() != null) { return annotation.getValue(); } for (XAnnotationElementValuePair pair : annotation.getElementValuePairs()) { if (pair.getElement() == jvmOperation) return pair.getValue(); } return null; }
/** * Provides scoping for MethodReference.operation. */ public IScope scopeFor_MethodReference_operation(final MethodReference context) { final Iterable<JvmOperation> fixtureMethods = this.getFixtureMethods(context.getTypeReference()); final Function<JvmOperation, QualifiedName> _function = (JvmOperation it) -> { return this._iQualifiedNameConverter.toQualifiedName(it.getSimpleName()); }; return Scopes.<JvmOperation>scopeFor(fixtureMethods, _function, IScope.NULLSCOPE); }
/** * Return all the cases that are associated with the given dispatch operation. */ public List<JvmOperation> getAllDispatchCases(JvmOperation dispatcherOperation) { DispatchSignature dispatchSignature = new DispatchSignature(dispatcherOperation.getSimpleName(), dispatcherOperation.getParameters().size()); JvmDeclaredType type = dispatcherOperation.getDeclaringType(); ITypeReferenceOwner owner = new StandardTypeReferenceOwner(services, type); ContextualVisibilityHelper contextualVisibilityHelper = new ContextualVisibilityHelper(visibilityHelper, owner.newParameterizedTypeReference(type)); return getAllDispatchMethods(dispatchSignature, type, contextualVisibilityHelper); }
private InferredPrototype getInferredPrototype(JvmOperation operation) { final XtendFunction fct = this.associations.getXtendFunction(operation); if (fct != null) { return getInferredPrototype(fct); } final QualifiedActionName actionKey = this.actionPrototypes.createQualifiedActionName( operation.getDeclaringType(), operation.getSimpleName()); // Compute the different action prototypes associated to the action to create. return this.actionPrototypes.createPrototypeFromJvmModel( actionKey, operation.isVarArgs(), operation.getParameters()); }
@Check public void checkLocalUsageOfDeclaredXtendFunction(XtendFunction function){ if(doCheckValidMemberName(function) && !isIgnored(UNUSED_PRIVATE_MEMBER)) { JvmOperation jvmOperation = function.isDispatch()?associations.getDispatchOperation(function):associations.getDirectlyInferredOperation(function); if(jvmOperation != null && jvmOperation.getVisibility() == JvmVisibility.PRIVATE && !isLocallyUsed(jvmOperation, getOutermostType(function))) { String message = "The method " + jvmOperation.getSimpleName() + uiStrings.parameters(jvmOperation) + " from the type "+ getDeclaratorName(jvmOperation)+" is never used locally."; addIssueToState(UNUSED_PRIVATE_MEMBER, message, XtendPackage.Literals.XTEND_FUNCTION__NAME); } } }