@Override public JvmTypeReference apply(JvmFormalParameter from) { return from.getParameterType(); } }));
protected LightweightTypeReference toLightweightTypeReference(JvmFormalParameter parameter) { JvmTypeReference parameterType = parameter.getParameterType(); if (parameterType == null) { return null; } LightweightTypeReference result = owner.toLightweightTypeReference(parameterType); return result; }
protected JvmTypeReference getParameterType(JvmFormalParameter declaredParam) { JvmTypeReference declaredType = declaredParam.getParameterType(); if (declaredType != null) { return declaredType; } return getType(declaredParam); }
protected Class<?>[] getParamTypes(JvmExecutable exe) { List<JvmFormalParameter> parameters = exe.getParameters(); List<Class<?>> result = Lists.newArrayList(); for (JvmFormalParameter p : parameters) { result.add(getRawType(p.getParameterType())); } return result.toArray(new Class<?>[result.size()]); }
@Check public void checkJvmFormalParameterNotPrimitiveVoid(JvmFormalParameter param) { if (typeReferences.is(param.getParameterType(), Void.TYPE)) { error("The primitive 'void' cannot be the type of a parameter", param.getParameterType(), null, IssueCodes.INVALID_USE_OF_TYPE); } }
protected void _format(final JvmFormalParameter expr, final FormattableDocument format) { JvmTypeReference _parameterType = expr.getParameterType(); boolean _tripleNotEquals = (_parameterType != null); if (_tripleNotEquals) { final Procedure1<FormattingDataInit> _function = (FormattingDataInit it) -> { it.oneSpace(); }; Function1<? super FormattableDocument, ? extends Iterable<FormattingData>> _append = this._formattingDataFactory.append(this._nodeModelAccess.nodeForEObject(expr.getParameterType()), _function); format.operator_add(_append); } this.format(expr.getParameterType(), format); }
protected void _format(final JvmFormalParameter expr, @Extension final IFormattableDocument format) { JvmTypeReference _parameterType = expr.getParameterType(); if (_parameterType!=null) { final Procedure1<IHiddenRegionFormatter> _function = (IHiddenRegionFormatter it) -> { it.oneSpace(); }; format.<JvmTypeReference>append(_parameterType, _function); } format.<JvmTypeReference>format(expr.getParameterType()); }
/** * @return the type of the parameter of the fixture of the given interaction at position index (if present) */ public JvmTypeReference getTypeOfFixtureParameter(final InteractionType interaction, final int index) { final EList<JvmFormalParameter> jvmParameters = interaction.getDefaultMethod().getOperation().getParameters(); int _size = jvmParameters.size(); boolean _greaterThan = (_size > index); if (_greaterThan) { return jvmParameters.get(index).getParameterType(); } else { return null; } }
protected boolean isSameSignature(JvmConstructor constructor, JvmConstructor superConstructor) { if(constructor.getParameters().size() != superConstructor.getParameters().size()) return false; for(int i=0; i<constructor.getParameters().size(); ++i) { JvmTypeReference paramType = constructor.getParameters().get(i).getParameterType(); JvmTypeReference superParamType = superConstructor.getParameters().get(i).getParameterType(); if(!paramType.getIdentifier().equals(superParamType.getIdentifier())) return false; } return true; } }
protected LightweightTypeReference getDeclaredParameterType(JvmFormalParameter declaredParam, final ITypeComputationState state) { JvmTypeReference parameterType = declaredParam.getParameterType(); if (parameterType == null) return null; return state.getReferenceOwner().toLightweightTypeReference(parameterType); }
protected boolean isMatchesSignature(JvmFormalParameter parameter, JvmFormalParameter candidateParameter, TypeParameterSubstitutor<?> substitutor, ITypeReferenceOwner owner) { JvmTypeReference parameterType = parameter.getParameterType(); if (parameterType == null || parameterType.getType() == null) { return false; } String identifier = parameterType.getIdentifier(); LightweightTypeReference candidateParameterType = substitutor.substitute(owner.toLightweightTypeReference(candidateParameter.getParameterType())); return identifier.equals(candidateParameterType.getJavaIdentifier()); }
@Override public Boolean apply(final JvmConstructor it) { return Boolean.valueOf(((it.getParameters().size() == 1) && EmfParsleyDslGuiceModuleHelper.this._emfParsleyDslTypeSystem.isConformant(context, AbstractUIPlugin.class, IterableExtensions.<JvmFormalParameter>head(it.getParameters()).getParameterType()))); } };
protected List<JvmType> getParamTypes(JvmOperation jvmOperation, boolean wrapPrimitives) { List<JvmType> types = newArrayList(); for (JvmFormalParameter p : jvmOperation.getParameters()) { LightweightTypeReference typeReference = toLightweightTypeReference(p.getParameterType()); if (wrapPrimitives) { typeReference = typeReference.getWrapperTypeIfPrimitive(); } types.add(typeReference.getType()); } return types; }
private boolean hasPrimitiveParameters(JvmOperation op) { for (final JvmFormalParameter parameter : op.getParameters()) { final JvmTypeReference type = parameter.getParameterType(); if (type == null || !Utils.toLightweightTypeReference(type, this.services).isPrimitive()) { return false; } } return true; }
@Override public TypeReference getType() { return this.getCompilationUnit().toTypeReference(this.getDelegate().getParameterType()); }
protected LightweightTypeReference getParameterType(JvmFormalParameter p) { JvmTypeReference parameterType = p.getParameterType(); JvmType type = parameterType.getType(); if (type == null) return null; return owner.toPlainTypeReference(type).getRawTypeReference(); }
private boolean hasPrimitiveParameters(JvmOperation op) { for (final JvmFormalParameter parameter : op.getParameters()) { final JvmTypeReference type = parameter.getParameterType(); if (type == null || !Utils.toLightweightTypeReference(type, this.services).isPrimitive()) { return false; } } return true; }
protected LightweightTypeReference getClosureOperationParameterType(LightweightTypeReference closureType, JvmOperation operation, int i) { ITypeReferenceOwner owner = newTypeReferenceOwner(operation); Map<JvmTypeParameter, LightweightMergedBoundTypeArgument> mapping = new DeclaratorTypeArgumentCollector().getTypeParameterMapping(closureType); LightweightTypeReference parameterType = owner.toLightweightTypeReference(operation.getParameters().get(i).getParameterType()); return new StandardTypeParameterSubstitutor(mapping, owner).substitute(parameterType); }
protected ITypeComputationState getSwitchExpressionState(XSwitchExpression expr, ITypeComputationState state) { JvmFormalParameter param = expr.getDeclaredParam(); if (param == null) { return state.withNonVoidExpectation(); } JvmTypeReference parameterType = param.getParameterType(); if (parameterType == null) { return state.withNonVoidExpectation(); } LightweightTypeReference expectation = state.getReferenceOwner().toLightweightTypeReference(parameterType); return state.withExpectation(expectation); }
@Override protected void _format(JvmFormalParameter expr, IFormattableDocument document) { final ISemanticRegionsFinder regionFor = this.textRegionExtensions.regionFor(expr); document.append(regionFor.keyword(this.keywords.getExtensionExtensionKeyword()), ONE_SPACE); final JvmTypeReference parameterType = expr.getParameterType(); if (parameterType != null) { document.surround(regionFor.keyword(this.keywords.getColonKeyword()), ONE_SPACE); document.surround(regionFor.keyword(this.keywords.getAsKeyword()), ONE_SPACE); } document.format(parameterType); }