protected void setCompilationStrategy(/* @Nullable */ JvmMember member, /* @Nullable */ StringConcatenationClient strategy) { if(member == null || strategy == null) return; CompilationTemplateAdapter adapter = new CompilationTemplateAdapter(); adapter.setCompilationTemplate(strategy); member.eAdapters().add(adapter); }
protected void setCompilationStrategy(/* @Nullable */ JvmMember member, /* @Nullable */ Procedures.Procedure1<ITreeAppendable> strategy) { if(member == null || strategy == null) return; CompilationStrategyAdapter adapter = new CompilationStrategyAdapter(); adapter.setCompilationStrategy(strategy); member.eAdapters().add(adapter); }
/** * Detaches any existing bodies from the {@link JvmMember}. * A body could be a logically container {@link XExpression} or a * black box compilation strategy. * * @param member the member to remove the body from */ public void removeExistingBody(/* @Nullable */ JvmMember member) { if (member != null) { // We have to be careful how to remove existing adapters due to an EMF bug: // https://bugs.eclipse.org/bugs/show_bug.cgi?id=462451 Object[] adapters = member.eAdapters().toArray(); for (int i = 0, j = 0; i < adapters.length; i++) { if (adapters[i] instanceof CompilationStrategyAdapter || adapters[i] instanceof CompilationTemplateAdapter) { member.eAdapters().remove(j); } else { j++; } } associator.removeLogicalChildAssociation(member); } }
public void setDocComment(final String docComment) { this.checkMutable(); Adapter _adapter = EcoreUtil.getAdapter(this.getDelegate().eAdapters(), DocumentationAdapter.class); DocumentationAdapter adapter = ((DocumentationAdapter) _adapter); if ((adapter == null)) { DocumentationAdapter _documentationAdapter = new DocumentationAdapter(); adapter = _documentationAdapter; EList<Adapter> _eAdapters = this.getDelegate().eAdapters(); _eAdapters.add(adapter); } adapter.setDocumentation(docComment); }
@Override public String getDocComment() { Adapter _adapter = EcoreUtil.getAdapter(this.getDelegate().eAdapters(), DocumentationAdapter.class); final DocumentationAdapter adapter = ((DocumentationAdapter) _adapter); String _documentation = null; if (adapter!=null) { _documentation=adapter.getDocumentation(); } return _documentation; }