/** Generate the given object. * * @param interf the interface. * @param it the target for the generated content. * @param context the context. */ protected void _generate(SarlInterface interf, PyAppendable it, IExtraLanguageGeneratorContext context) { generateTypeDeclaration( this.qualifiedNameProvider.getFullyQualifiedName(interf).toString(), interf.getName(), true, interf.getExtends(), getTypeBuilder().getDocumentation(interf), true, interf.getMembers(), it, context, null); }
/** Replies the resource to which the SarlInterface is attached. */ @Pure public Resource eResource() { return getSarlInterface().eResource(); }
/** Add a modifier. * @param modifier the modifier to add. */ public void addModifier(String modifier) { if (!Strings.isEmpty(modifier)) { this.sarlInterface.getModifiers().add(modifier); } }
/** Add the super type. * @param superType the qualified name of the super type. */ public void addExtends(String superType) { if (!Strings.isEmpty(superType)) { JvmParameterizedTypeReference superTypeRef = newTypeRef(this.container, superType); this.sarlInterface.getExtends().add(superTypeRef); return; } }
/** Initialize the Ecore element when inside a script. */ public void eInit(SarlScript script, String name, IJvmTypeProvider context) { setTypeResolutionContext(context); if (this.sarlInterface == null) { this.container = script; this.sarlInterface = SarlFactory.eINSTANCE.createSarlInterface(); script.getXtendTypes().add(this.sarlInterface); this.sarlInterface.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendTypeDeclaration()); if (!Strings.isEmpty(name)) { this.sarlInterface.setName(name); } } }
/** Initialize the Ecore element when inner type declaration. */ public void eInit(XtendTypeDeclaration container, String name, IJvmTypeProvider context) { if (this.sarlInterface == null) { this.container = container; this.sarlInterface = SarlFactory.eINSTANCE.createSarlInterface(); container.getMembers().add(this.sarlInterface); if (!Strings.isEmpty(name)) { this.sarlInterface.setName(name); } } }
/** Add a type parameter. * @param name the simple name of the type parameter. * @return the builder of type parameter. */ public ITypeParameterBuilder addTypeParameter(String name) { ITypeParameterBuilder builder = this.iTypeParameterBuilderProvider.get(); final SarlInterface object = getSarlInterface(); builder.eInit(object, name, getTypeResolutionContext()); object.getTypeParameters().add(builder.getJvmTypeParameter()); return builder; }
/** Change the documentation of the element. * * <p>The documentation will be displayed just before the element. * * @param doc the documentation. */ public void setDocumentation(String doc) { if (Strings.isEmpty(doc)) { getSarlInterface().eAdapters().removeIf(new Predicate<Adapter>() { public boolean test(Adapter adapter) { return adapter.isAdapterForType(DocumentationAdapter.class); } }); } else { DocumentationAdapter adapter = (DocumentationAdapter) EcoreUtil.getExistingAdapter( getSarlInterface(), DocumentationAdapter.class); if (adapter == null) { adapter = new DocumentationAdapter(); getSarlInterface().eAdapters().add(adapter); } adapter.setDocumentation(doc); } }
/** Check if implemented interfaces of a Xtend Interface are redundant. * * @param xtendInterface the interface. */ @Check public void checkRedundantImplementedInterfaces(SarlInterface xtendInterface) { checkRedundantInterfaces( xtendInterface, XTEND_INTERFACE__EXTENDS, xtendInterface.getExtends(), Collections.<JvmTypeReference>emptyList()); }
/** Generate the given object. * * @param interf the interface. * @param context the context. */ protected void _generate(SarlInterface interf, IExtraLanguageGeneratorContext context) { final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(interf); final PyAppendable appendable = createAppendable(jvmType, context); if (generateTypeDeclaration( this.qualifiedNameProvider.getFullyQualifiedName(interf).toString(), interf.getName(), true, interf.getExtends(), getTypeBuilder().getDocumentation(interf), true, interf.getMembers(), appendable, context, null)) { final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(interf); writeFile(name, appendable, context); } }
/** Replies the resource to which the SarlInterface is attached. */ @Pure public Resource eResource() { return getSarlInterface().eResource(); }