/** * @since 2.16 */ protected void appendCompilationTemplate(final ITreeAppendable appendable, final JvmIdentifiableElement it) { boolean _matched = false; if (appendable instanceof TreeAppendable) { _matched=true; SharedAppendableState _state = ((TreeAppendable)appendable).getState(); StandardTypeReferenceOwner _standardTypeReferenceOwner = new StandardTypeReferenceOwner(this.commonServices, it); final ImportingStringConcatenation target = this.createImportingStringConcatenation(_state, _standardTypeReferenceOwner); target.append(this._jvmTypeExtensions.getCompilationTemplate(it)); ((TreeAppendable)appendable).append(target); } if (!_matched) { String _name = appendable.getClass().getName(); String _plus = ("unexpected appendable: " + _name); throw new IllegalStateException(_plus); } }
public CharSequence generateType(final JvmDeclaredType type, final GeneratorConfig config) { final ImportManager importManager = this.createImportManager(type); final TreeAppendable bodyAppendable = this.createAppendable(type, importManager, config); bodyAppendable.openScope(); this.assignThisAndSuper(bodyAppendable, type, config); this.generateBody(type, bodyAppendable, config); bodyAppendable.closeScope(); final TreeAppendable importAppendable = this.createAppendable(type, importManager, config); this.generateFileHeader(type, importAppendable, config); String _packageName = type.getPackageName(); boolean _tripleNotEquals = (_packageName != null); if (_tripleNotEquals) { importAppendable.append("package ").append(type.getPackageName()).append(";"); importAppendable.newLine().newLine(); } List<String> _imports = importManager.getImports(); for (final String i : _imports) { importAppendable.append("import ").append(i).append(";").newLine(); } boolean _isEmpty = importManager.getImports().isEmpty(); boolean _not = (!_isEmpty); if (_not) { importAppendable.newLine(); } importAppendable.append(bodyAppendable); return importAppendable; }
@Override public TreeAppendable append(JvmType type) { if(type.eIsProxy()) { String fragment = ((InternalEObject)type).eProxyURI().fragment(); Triple<EObject, EReference, INode> unresolvedLink = encoder.decode(getState().getResource(), fragment); if(unresolvedLink != null) { INode linkNode = unresolvedLink.getThird(); if(linkNode != null) { append(NodeModelUtils.getTokenText(linkNode)); return this; } } append("unresolved type"); return this; } return super.append(type); }