public void completeJvmConstructor(JvmConstructor constructor) { JvmDeclaredType declaringType = constructor.getDeclaringType(); if(declaringType != null) { String simpleName = declaringType.getSimpleName(); if(simpleName != null) { constructor.setSimpleName(simpleName); return; } } constructor.setSimpleName("unset"); }
protected JvmConstructor inferAnonymousClassConstructor(AnonymousClass anonymousClass, JvmGenericType inferredLocalClass) { XConstructorCall constructorCall = anonymousClass.getConstructorCall(); JvmConstructor constructor = TypesFactory.eINSTANCE.createJvmConstructor(); inferredLocalClass.getMembers().add(constructor); associator.associatePrimary(constructorCall, constructor); constructor.setVisibility(JvmVisibility.DEFAULT); constructor.setSimpleName(inferredLocalClass.getSimpleName()); return constructor; }
protected void addDefaultConstructor(XtendClass source, JvmGenericType target) { for (XtendMember member : source.getMembers()) { if (member instanceof XtendConstructor) return; } JvmConstructor constructor = typesFactory.createJvmConstructor(); target.getMembers().add(constructor); associator.associate(source, constructor); constructor.setSimpleName(source.getName()); constructor.setVisibility(JvmVisibility.PUBLIC); typeExtensions.setSynthetic(constructor, true); }
public JvmConstructor inferConstructor(final PatternModel model, final JvmType groupClass, final boolean includePrivate) { final Procedure1<JvmConstructor> _function = (JvmConstructor it) -> { it.setVisibility(JvmVisibility.PRIVATE); it.setSimpleName(this.groupClassName(model, includePrivate)); StringConcatenationClient _client = new StringConcatenationClient() { @Override
protected void completeJvmGenericType(JvmGenericType element) { // if no super type add Object ensureSuperTypeObject(element); addAnnotations(element); if (!element.isInterface()) { // if no constructors have been added, add a default constructor if (isEmpty(element.getDeclaredConstructors())) { JvmConstructor constructor = TypesFactory.eINSTANCE.createJvmConstructor(); constructor.setSimpleName(element.getSimpleName()); constructor.setVisibility(JvmVisibility.PUBLIC); typeExtensions.setSynthetic(constructor, true); EObject primarySourceElement = associations.getPrimarySourceElement(element); if (primarySourceElement != null) { associator.associate(primarySourceElement, constructor); } element.getMembers().add(constructor); } } }
public MutableConstructorDeclaration addConstructor(final Procedure1<MutableConstructorDeclaration> initializer) { this.checkMutable(); Preconditions.checkArgument((initializer != null), "initializer cannot be null"); final Function1<JvmConstructor, Boolean> _function = (JvmConstructor it) -> { return Boolean.valueOf(this.getCompilationUnit().getTypeExtensions().isSingleSyntheticDefaultConstructor(it)); }; final JvmConstructor constructor = IterableExtensions.<JvmConstructor>findFirst(Iterables.<JvmConstructor>filter(this.getDelegate().getMembers(), JvmConstructor.class), _function); if ((constructor != null)) { EcoreUtil.remove(constructor); } final JvmConstructor newConstructor = TypesFactory.eINSTANCE.createJvmConstructor(); newConstructor.setVisibility(JvmVisibility.PUBLIC); newConstructor.setSimpleName(this.getSimpleName()); this.getDelegate().getMembers().add(newConstructor); MemberDeclaration _memberDeclaration = this.getCompilationUnit().toMemberDeclaration(newConstructor); final MutableConstructorDeclaration mutableConstructorDeclaration = ((MutableConstructorDeclaration) _memberDeclaration); initializer.apply(mutableConstructorDeclaration); return mutableConstructorDeclaration; }
it.setVisibility(JvmVisibility.PRIVATE); String _groupClassName = PatternGroupClassInferrer.this.groupClassName(model); it.setSimpleName(_groupClassName); EList<JvmTypeReference> _exceptions = it.getExceptions(); PatternGroupClassInferrer.this._eMFJvmTypesBuilder.<JvmTypeReference>operator_add(_exceptions, incQueryException);
} else constructor.setVisibility(JvmVisibility.PRIVATE); constructor.setSimpleName(inferredLocalClass.getSimpleName()); constructor.setVarArgs(superConstructor.isVarArgs()); final List<JvmFormalParameter> parameters = superConstructor.getParameters();
protected void transform(XtendConstructor source, JvmGenericType container) { JvmConstructor constructor = typesFactory.createJvmConstructor(); container.getMembers().add(constructor); associator.associatePrimary(source, constructor); JvmVisibility visibility = source.getVisibility(); constructor.setSimpleName(container.getSimpleName()); constructor.setVisibility(visibility); for (XtendParameter parameter : source.getParameters()) { translateParameter(constructor, parameter); } copyAndFixTypeParameters(source.getTypeParameters(), constructor); for (JvmTypeReference exception : source.getExceptions()) { constructor.getExceptions().add(jvmTypesBuilder.cloneWithProxies(exception)); } translateAnnotationsTo(source.getAnnotations(), constructor); setBody(constructor, source.getExpression()); jvmTypesBuilder.copyDocumentationTo(source, constructor); }
@Override public void apply(final JvmConstructor it) { String _matcherClassName = PatternMatcherClassInferrer.this._eMFPatternLanguageJvmModelInferrerUtil.matcherClassName(pattern); it.setSimpleName(_matcherClassName); EList<JvmAnnotationReference> _annotations = it.getAnnotations(); JvmAnnotationReference _annotationRef = PatternMatcherClassInferrer.this.annBuilder.annotationRef(Deprecated.class); PatternMatcherClassInferrer.this._eMFJvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef); it.setVisibility(JvmVisibility.PUBLIC); CharSequence _javadocMatcherConstructorEngine = PatternMatcherClassInferrer.this._javadocInferrer.javadocMatcherConstructorEngine(pattern); String _string = _javadocMatcherConstructorEngine.toString(); PatternMatcherClassInferrer.this._eMFJvmTypesBuilder.setDocumentation(it, _string); EList<JvmFormalParameter> _parameters = it.getParameters(); JvmTypeReference _typeRef = PatternMatcherClassInferrer.this.builder.typeRef(IncQueryEngine.class); JvmFormalParameter _parameter = PatternMatcherClassInferrer.this._eMFJvmTypesBuilder.toParameter(pattern, "engine", _typeRef); PatternMatcherClassInferrer.this._eMFJvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter); EList<JvmTypeReference> _exceptions = it.getExceptions(); JvmTypeReference _typeRef_1 = PatternMatcherClassInferrer.this.builder.typeRef(IncQueryException.class); PatternMatcherClassInferrer.this._eMFJvmTypesBuilder.<JvmTypeReference>operator_add(_exceptions, _typeRef_1); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("super(engine, querySpecification());"); } }; PatternMatcherClassInferrer.this._eMFJvmTypesBuilder.setBody(it, _client); } };
@Override public void apply(final JvmConstructor it) { String _matchClassName = PatternMatchClassInferrer.this._eMFPatternLanguageJvmModelInferrerUtil.matchClassName(pattern); it.setSimpleName(_matchClassName); it.setVisibility(JvmVisibility.PRIVATE); EList<Variable> _parameters = pattern.getParameters();
@Override public void apply(final JvmConstructor it) { String _matcherClassName = PatternMatcherClassInferrer.this._eMFPatternLanguageJvmModelInferrerUtil.matcherClassName(pattern); it.setSimpleName(_matcherClassName); EList<JvmAnnotationReference> _annotations = it.getAnnotations(); JvmAnnotationReference _annotationRef = PatternMatcherClassInferrer.this.annBuilder.annotationRef(Deprecated.class); PatternMatcherClassInferrer.this._eMFJvmTypesBuilder.<JvmAnnotationReference>operator_add(_annotations, _annotationRef); it.setVisibility(JvmVisibility.PUBLIC); CharSequence _javadocMatcherConstructorNotifier = PatternMatcherClassInferrer.this._javadocInferrer.javadocMatcherConstructorNotifier(pattern); String _string = _javadocMatcherConstructorNotifier.toString(); PatternMatcherClassInferrer.this._eMFJvmTypesBuilder.setDocumentation(it, _string); EList<JvmFormalParameter> _parameters = it.getParameters(); JvmTypeReference _typeRef = PatternMatcherClassInferrer.this.builder.typeRef(Notifier.class); JvmFormalParameter _parameter = PatternMatcherClassInferrer.this._eMFJvmTypesBuilder.toParameter(pattern, "emfRoot", _typeRef); PatternMatcherClassInferrer.this._eMFJvmTypesBuilder.<JvmFormalParameter>operator_add(_parameters, _parameter); EList<JvmTypeReference> _exceptions = it.getExceptions(); JvmTypeReference _typeRef_1 = PatternMatcherClassInferrer.this.builder.typeRef(IncQueryException.class); PatternMatcherClassInferrer.this._eMFJvmTypesBuilder.<JvmTypeReference>operator_add(_exceptions, _typeRef_1); StringConcatenationClient _client = new StringConcatenationClient() { @Override protected void appendTo(StringConcatenationClient.TargetStringConcatenation _builder) { _builder.append("this("); _builder.append(IncQueryEngine.class, ""); _builder.append(".on(emfRoot));"); } }; PatternMatcherClassInferrer.this._eMFJvmTypesBuilder.setBody(it, _client); } };
container.getMembers().add(constructor); this.associator.associatePrimary(source, constructor); constructor.setSimpleName(constructorName); setVisibility(constructor, source); constructor.setVarArgs(isVarArgs); container.getMembers().add(constructor2); copyAndCleanDocumentationTo(source, constructor2); constructor2.setSimpleName(container.getSimpleName()); constructor2.setVisibility(constructor.getVisibility()); constructor2.setVarArgs(isVarArgs);
final JvmConstructor newCons = this.typesFactory.createJvmConstructor(); newCons.setDeprecated(constructor.isDeprecated()); newCons.setSimpleName(target.getSimpleName()); target.getMembers().add(newCons);
EList<JvmMember> _members = it.getMembers(); final Procedure1<JvmConstructor> _function_1 = (JvmConstructor it_1) -> { it_1.setSimpleName(innerClassName); it_1.setVisibility(JvmVisibility.DEFAULT); EList<Variable> _parameters = pattern.getParameters();