org.eclipse.xtend.lib.macro.declaration.MutableParameterDeclaration Java Examples
The following examples show how to use
org.eclipse.xtend.lib.macro.declaration.MutableParameterDeclaration.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FinalFieldsConstructorProcessor.java From xtext-lib with Eclipse Public License 2.0 | 5 votes |
public boolean hasFinalFieldsConstructor(final MutableTypeDeclaration cls) { boolean _xblockexpression = false; { final ArrayList<TypeReference> expectedTypes = this.getFinalFieldsConstructorArgumentTypes(cls); final Function1<MutableConstructorDeclaration, Boolean> _function = (MutableConstructorDeclaration it) -> { final Function1<MutableParameterDeclaration, TypeReference> _function_1 = (MutableParameterDeclaration it_1) -> { return it_1.getType(); }; List<TypeReference> _list = IterableExtensions.<TypeReference>toList(IterableExtensions.map(it.getParameters(), _function_1)); return Boolean.valueOf(Objects.equal(_list, expectedTypes)); }; _xblockexpression = IterableExtensions.exists(cls.getDeclaredConstructors(), _function); } return _xblockexpression; }
Example #2
Source File: ExtractProcessor.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override public void doTransform(final MutableClassDeclaration annotatedClass, @Extension final TransformationContext context) { final MutableInterfaceDeclaration interfaceType = context.findInterface(this.getInterfaceName(annotatedClass)); context.setPrimarySourceElement(interfaceType, annotatedClass); Iterable<? extends TypeReference> _implementedInterfaces = annotatedClass.getImplementedInterfaces(); TypeReference _newTypeReference = context.newTypeReference(interfaceType); Iterable<TypeReference> _plus = Iterables.<TypeReference>concat(_implementedInterfaces, Collections.<TypeReference>unmodifiableList(CollectionLiterals.<TypeReference>newArrayList(_newTypeReference))); annotatedClass.setImplementedInterfaces(_plus); Iterable<? extends MutableMethodDeclaration> _declaredMethods = annotatedClass.getDeclaredMethods(); for (final MutableMethodDeclaration method : _declaredMethods) { Visibility _visibility = method.getVisibility(); boolean _equals = Objects.equal(_visibility, Visibility.PUBLIC); if (_equals) { final Procedure1<MutableMethodDeclaration> _function = (MutableMethodDeclaration it) -> { it.setDocComment(method.getDocComment()); it.setReturnType(method.getReturnType()); Iterable<? extends MutableParameterDeclaration> _parameters = method.getParameters(); for (final MutableParameterDeclaration p : _parameters) { it.addParameter(p.getSimpleName(), p.getType()); } it.setExceptions(((TypeReference[])Conversions.unwrapArray(method.getExceptions(), TypeReference.class))); context.setPrimarySourceElement(it, method); }; interfaceType.addMethod(method.getSimpleName(), _function); } } }
Example #3
Source File: CheckMutableParameterDeclarationProcessor.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override public void doTransform(final List<? extends MutableParameterDeclaration> annotatedTargetElements, @Extension final TransformationContext context) { for (final MutableParameterDeclaration annotatedTargetElement : annotatedTargetElements) { final Procedure1<String> _function = (String identifier) -> { annotatedTargetElement.setSimpleName(identifier); }; MutableAssert.assertValidJavaIdentifier("name", _function); } }
Example #4
Source File: JvmExecutableDeclarationImpl.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
public MutableParameterDeclaration addParameter(final String name, final TypeReference type) { this.checkMutable(); ConditionUtils.checkJavaIdentifier(name, "name"); Preconditions.checkArgument((type != null), "type cannot be null"); boolean _isInferred = type.isInferred(); if (_isInferred) { throw new IllegalArgumentException("Cannot use inferred type as parameter type."); } final JvmFormalParameter param = TypesFactory.eINSTANCE.createJvmFormalParameter(); param.setName(name); param.setParameterType(this.getCompilationUnit().toJvmTypeReference(type)); this.getDelegate().getParameters().add(param); ParameterDeclaration _parameterDeclaration = this.getCompilationUnit().toParameterDeclaration(param); return ((MutableParameterDeclaration) _parameterDeclaration); }
Example #5
Source File: CheckMutableParameterDeclarationProcessor.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Override public void doGenerateCode(final List<? extends MutableParameterDeclaration> annotatedSourceElements, @Extension final CodeGenerationContext context) { }
Example #6
Source File: MutableJvmConstructorDeclarationImpl.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Override public Iterable<? extends MutableParameterDeclaration> getParameters() { Iterable<? extends ParameterDeclaration> _parameters = super.getParameters(); return ((Iterable<? extends MutableParameterDeclaration>) _parameters); }
Example #7
Source File: MutableJvmMethodDeclarationImpl.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
@Override public Iterable<? extends MutableParameterDeclaration> getParameters() { Iterable<? extends ParameterDeclaration> _parameters = super.getParameters(); return ((Iterable<? extends MutableParameterDeclaration>) _parameters); }