com.reprezen.genflow.rapidml.csharp.helpers.DocHelper Maven / Gradle / Ivy
package com.reprezen.genflow.rapidml.csharp.helpers;
import com.reprezen.rapidml.Documentable;
import com.reprezen.rapidml.Documentation;
import java.util.List;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Conversions;
@SuppressWarnings("all")
public class DocHelper {
public static CharSequence simpleDoc(final Documentable item) {
Documentation _documentation = item.getDocumentation();
String _text = null;
if (_documentation!=null) {
_text=_documentation.getText();
}
CharSequence _simpleDoc = null;
if (_text!=null) {
_simpleDoc=DocHelper.simpleDoc(_text);
}
return _simpleDoc;
}
public static CharSequence simpleDoc(final String doc) {
CharSequence _xblockexpression = null;
{
final String[] lines = doc.split("\n");
CharSequence _xifexpression = null;
int _size = ((List)Conversions.doWrapArray(lines)).size();
boolean _equals = (_size == 1);
if (_equals) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("/// ");
String _get = lines[0];
_builder.append(_get, "");
_builder.append(" ");
_builder.newLineIfNotEmpty();
_xifexpression = _builder;
} else {
StringConcatenation _builder_1 = new StringConcatenation();
_builder_1.append("/// ");
_builder_1.newLine();
{
for(final String line : lines) {
_builder_1.append("/// ");
_builder_1.append(line, "");
_builder_1.newLineIfNotEmpty();
}
}
_builder_1.append("/// ");
_builder_1.newLine();
_xifexpression = _builder_1;
}
_xblockexpression = _xifexpression;
}
return _xblockexpression;
}
}