/** Replies the resource to which the SarlAnnotationType is attached. */ @Pure public Resource eResource() { return getSarlAnnotationType().eResource(); }
/** Add a modifier. * @param modifier the modifier to add. */ public void addModifier(String modifier) { if (!Strings.isEmpty(modifier)) { this.sarlAnnotationType.getModifiers().add(modifier); } }
/** Initialize the Ecore element when inside a script. */ public void eInit(SarlScript script, String name, IJvmTypeProvider context) { setTypeResolutionContext(context); if (this.sarlAnnotationType == null) { this.container = script; this.sarlAnnotationType = SarlFactory.eINSTANCE.createSarlAnnotationType(); script.getXtendTypes().add(this.sarlAnnotationType); this.sarlAnnotationType.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendTypeDeclaration()); if (!Strings.isEmpty(name)) { this.sarlAnnotationType.setName(name); } } }
/** Generate the given object. * * @param annotation the annotation. * @param it the target for the generated content. * @param context the context. */ protected void _generate(SarlAnnotationType annotation, PyAppendable it, IExtraLanguageGeneratorContext context) { generateTypeDeclaration( this.qualifiedNameProvider.getFullyQualifiedName(annotation).toString(), annotation.getName(), false, Collections.emptyList(), getTypeBuilder().getDocumentation(annotation), true, annotation.getMembers(), it, context, null); }
/** Initialize the Ecore element when inner type declaration. */ public void eInit(XtendTypeDeclaration container, String name, IJvmTypeProvider context) { if (this.sarlAnnotationType == null) { this.container = container; this.sarlAnnotationType = SarlFactory.eINSTANCE.createSarlAnnotationType(); container.getMembers().add(this.sarlAnnotationType); if (!Strings.isEmpty(name)) { this.sarlAnnotationType.setName(name); } } }
/** 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)) { getSarlAnnotationType().eAdapters().removeIf(new Predicate<Adapter>() { public boolean test(Adapter adapter) { return adapter.isAdapterForType(DocumentationAdapter.class); } }); } else { DocumentationAdapter adapter = (DocumentationAdapter) EcoreUtil.getExistingAdapter( getSarlAnnotationType(), DocumentationAdapter.class); if (adapter == null) { adapter = new DocumentationAdapter(); getSarlAnnotationType().eAdapters().add(adapter); } adapter.setDocumentation(doc); } }
/** Generate the given object. * * @param annotation the annotation. * @param context the context. */ protected void _generate(SarlAnnotationType annotation, IExtraLanguageGeneratorContext context) { final JvmDeclaredType jvmType = getJvmModelAssociations().getInferredType(annotation); final PyAppendable appendable = createAppendable(jvmType, context); if (generateTypeDeclaration( this.qualifiedNameProvider.getFullyQualifiedName(annotation).toString(), annotation.getName(), false, Collections.emptyList(), getTypeBuilder().getDocumentation(annotation), true, annotation.getMembers(), appendable, context, null)) { final QualifiedName name = getQualifiedNameProvider().getFullyQualifiedName(annotation); writeFile(name, appendable, context); } }
/** Replies the resource to which the SarlAnnotationType is attached. */ @Pure public Resource eResource() { return getSarlAnnotationType().eResource(); }