All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.reprezen.genflow.openapi3.doc.StructureTable Maven / Gradle / Ivy

package com.reprezen.genflow.openapi3.doc;

import com.google.common.base.Objects;
import com.reprezen.genflow.openapi3.doc.Activation;
import com.reprezen.genflow.openapi3.doc.ArrayHelper;
import com.reprezen.genflow.openapi3.doc.AttrDetails;
import com.reprezen.genflow.openapi3.doc.AttributeHelper;
import com.reprezen.genflow.openapi3.doc.BadArrayException;
import com.reprezen.genflow.openapi3.doc.BadReferenceException;
import com.reprezen.genflow.openapi3.doc.DocHelper;
import com.reprezen.genflow.openapi3.doc.HelperHelper;
import com.reprezen.genflow.openapi3.doc.HtmlHelper;
import com.reprezen.genflow.openapi3.doc.Indentation;
import com.reprezen.genflow.openapi3.doc.KaiZenParserHelper;
import com.reprezen.genflow.openapi3.doc.OptionHelper;
import com.reprezen.genflow.openapi3.doc.RecursionHelper;
import com.reprezen.genflow.openapi3.doc.RecursiveRenderException;
import com.reprezen.genflow.openapi3.doc.RefHelper;
import com.reprezen.kaizen.oasparser.model3.Parameter;
import com.reprezen.kaizen.oasparser.model3.Schema;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
import org.eclipse.xtext.xbase.lib.Conversions;
import org.eclipse.xtext.xbase.lib.Exceptions;
import org.eclipse.xtext.xbase.lib.Extension;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.eclipse.xtext.xbase.lib.ListExtensions;

@SuppressWarnings("all")
public abstract class StructureTable {
  public static class SchemaStructureTable extends StructureTable {
    public SchemaStructureTable(final Schema obj, final String[]... cols) {
      super(obj, cols);
    }
    
    @Override
    protected String render(final String name, final Object referrer, final Indentation ind) {
      String _xblockexpression = null;
      {
        String _type = this.obj.getType();
        boolean _equals = Objects.equal(_type, "array");
        if (_equals) {
          Schema _elementType = this._arrayHelper.getElementType(this.obj);
          final AttrDetails det = new AttrDetails(_elementType);
          Schema _elementType_1 = this._arrayHelper.getElementType(this.obj);
          final StructureTable.SchemaStructureTable itemsTable = new StructureTable.SchemaStructureTable(_elementType_1, this.cols);
          StringConcatenation _builder = new StringConcatenation();
          String _defaultRender = this.defaultRender(name, referrer, ind, det);
          _builder.append(_defaultRender);
          _builder.newLineIfNotEmpty();
          String _renderObject = itemsTable.renderObject(null, null, ind.advance2());
          _builder.append(_renderObject);
          _builder.newLineIfNotEmpty();
          return _builder.toString();
        }
        final AttrDetails det_1 = new AttrDetails(this.obj);
        Schema _xtrycatchfinallyexpression = null;
        try {
          Schema _additionalPropertiesSchema = this.obj.getAdditionalPropertiesSchema();
          Schema _asNullIfMissing = null;
          if (_additionalPropertiesSchema!=null) {
            _asNullIfMissing=this._kaiZenParserHelper.asNullIfMissing(_additionalPropertiesSchema);
          }
          _xtrycatchfinallyexpression = _asNullIfMissing;
        } catch (final Throwable _t) {
          if (_t instanceof NullPointerException) {
            _xtrycatchfinallyexpression = null;
          } else {
            throw Exceptions.sneakyThrow(_t);
          }
        }
        final Schema additionalPropertiesSchema = _xtrycatchfinallyexpression;
        final List allOfSchemas = this.obj.getAllOfSchemas();
        final List oneOfSchemas = this.obj.getOneOfSchemas();
        final List anyOfSchemas = this.obj.getAnyOfSchemas();
        ind.use2();
        ind.advance2();
        String _xifexpression = null;
        if ((name != null)) {
          _xifexpression = this.defaultRender(name, referrer, ind, det_1);
        }
        final String modelRow = _xifexpression;
        StringConcatenation _builder_1 = new StringConcatenation();
        _builder_1.append(modelRow);
        {
          Set> _entrySet = this.obj.getProperties().entrySet();
          for(final Map.Entry prop : _entrySet) {
            Schema _value = prop.getValue();
            StructureTable.SchemaStructureTable _schemaStructureTable = new StructureTable.SchemaStructureTable(_value, this.cols);
            String _key = prop.getKey();
            String _plus = ("!" + _key);
            String _renderObject_1 = _schemaStructureTable.renderObject(_plus, this.obj, ind.advance2());
            _builder_1.append(_renderObject_1);
          }
        }
        _builder_1.newLineIfNotEmpty();
        {
          if ((additionalPropertiesSchema != null)) {
            String _renderObject_2 = new StructureTable.SchemaStructureTable(additionalPropertiesSchema, this.cols).renderObject("![additional properties]", this.obj, ind.advance2());
            _builder_1.append(_renderObject_2);
            _builder_1.newLineIfNotEmpty();
          }
        }
        {
          boolean _isEmpty = allOfSchemas.isEmpty();
          boolean _not = (!_isEmpty);
          if (_not) {
            {
              for(final Schema schema : allOfSchemas) {
                String _renderMemberModel = this.renderMemberModel(schema, "allOf", ind.advance2(), det_1);
                _builder_1.append(_renderMemberModel);
                _builder_1.newLineIfNotEmpty();
              }
            }
          }
        }
        {
          boolean _isEmpty_1 = oneOfSchemas.isEmpty();
          boolean _not_1 = (!_isEmpty_1);
          if (_not_1) {
            {
              for(final Schema schema_1 : oneOfSchemas) {
                String _renderMemberModel_1 = this.renderMemberModel(schema_1, "oneOf", ind.advance2(), det_1);
                _builder_1.append(_renderMemberModel_1);
                _builder_1.newLineIfNotEmpty();
              }
            }
          }
        }
        {
          boolean _isEmpty_2 = anyOfSchemas.isEmpty();
          boolean _not_2 = (!_isEmpty_2);
          if (_not_2) {
            {
              for(final Schema schema_2 : anyOfSchemas) {
                String _renderMemberModel_2 = this.renderMemberModel(schema_2, "anyOf", ind.advance2(), det_1);
                _builder_1.append(_renderMemberModel_2);
                _builder_1.newLineIfNotEmpty();
              }
            }
          }
        }
        _xblockexpression = _builder_1.toString();
      }
      return _xblockexpression;
    }
    
    @Override
    protected String getTypeSpec(final AttrDetails det) {
      String _xblockexpression = null;
      {
        String _type = this.obj.getType();
        boolean _equals = Objects.equal(_type, "array");
        if (_equals) {
          StringConcatenation _builder = new StringConcatenation();
          String _arrayTypeSpec = this._arrayHelper.getArrayTypeSpec(this.obj);
          _builder.append(_arrayTypeSpec);
          CharSequence _infoButton = det.getInfoButton();
          _builder.append(_infoButton);
          return _builder.toString();
        }
        _xblockexpression = this.getTypeSpec(this.obj, det);
      }
      return _xblockexpression;
    }
    
    protected String getTypeSpec(final Schema model, final AttrDetails det) {
      final String modelType = this.getDefaultTypeSpec(model);
      StringConcatenation _builder = new StringConcatenation();
      _builder.append(modelType);
      CharSequence _infoButton = det.getInfoButton();
      _builder.append(_infoButton);
      return _builder.toString();
    }
    
    protected String renderMemberModel(final Schema memberModel, final String label, final Indentation ind, final AttrDetails det) {
      StringConcatenation _builder = new StringConcatenation();
      String _renderMemberRow = this.renderMemberRow(memberModel, label, ind.copy(), det);
      _builder.append(_renderMemberRow);
      _builder.newLineIfNotEmpty();
      String _renderObject = new StructureTable.SchemaStructureTable(memberModel, this.cols).renderObject(null, null, ind.copy());
      _builder.append(_renderObject);
      _builder.newLineIfNotEmpty();
      return _builder.toString();
    }
    
    private String renderMemberRow(final Schema member, final String label, final Indentation ind, final AttrDetails det) {
      String _xifexpression = null;
      Boolean _isShowComponentModels = this._optionHelper.isShowComponentModels();
      if ((_isShowComponentModels).booleanValue()) {
        String _xblockexpression = null;
        {
          StringConcatenation _builder = new StringConcatenation();
          _builder.append("");
          _builder.append(label);
          _builder.append(": ");
          String _typeSpec = this.getTypeSpec(member, det);
          String _htmlEscape = null;
          if (_typeSpec!=null) {
            _htmlEscape=this._htmlHelper.htmlEscape(_typeSpec);
          }
          String _samp = null;
          if (_htmlEscape!=null) {
            _samp=this._htmlHelper.getSamp(_htmlEscape);
          }
          _builder.append(_samp);
          _builder.append("");
          final String text = _builder.toString();
          String _indentTextToCode = this.indentTextToCode(text.toString(), ind);
          _xblockexpression = this.wrapHeaderRow(Collections.unmodifiableList(CollectionLiterals.newArrayList(_indentTextToCode)));
        }
        _xifexpression = _xblockexpression;
      }
      return _xifexpression;
    }
    
    @Override
    protected String getDoc() {
      String _description = this.obj.getDescription();
      String _docHtml = null;
      if (_description!=null) {
        _docHtml=this._docHelper.getDocHtml(_description);
      }
      return _docHtml;
    }
  }
  
  public static class ParameterStructureTable extends StructureTable {
    public ParameterStructureTable(final Parameter obj, final String[]... cols) {
      super(obj, cols);
    }
    
    @Override
    protected String render(final String name, final Object referrer, final Indentation ind) {
      String _xblockexpression = null;
      {
        Schema _xifexpression = null;
        String _type = this.obj.getSchema().getType();
        boolean _equals = Objects.equal(_type, "array");
        if (_equals) {
          _xifexpression = this._arrayHelper.getElementType(this.obj.getSchema());
        } else {
          _xifexpression = this.obj.getSchema();
        }
        final Schema detailType = _xifexpression;
        final AttrDetails det = new AttrDetails(detailType);
        StringConcatenation _builder = new StringConcatenation();
        String _defaultRender = this.defaultRender(name, referrer, ind, det);
        _builder.append(_defaultRender);
        _builder.newLineIfNotEmpty();
        _xblockexpression = _builder.toString();
      }
      return _xblockexpression;
    }
    
    @Override
    protected String getTypeSpec(final AttrDetails det) {
      String _xblockexpression = null;
      {
        final Parameter param = this.obj;
        String _xifexpression = null;
        String _type = param.getSchema().getType();
        boolean _equals = Objects.equal(_type, "array");
        if (_equals) {
          StringConcatenation _builder = new StringConcatenation();
          String _arrayTypeSpec = this._arrayHelper.getArrayTypeSpec(param.getSchema());
          _builder.append(_arrayTypeSpec);
          CharSequence _infoButton = det.getInfoButton();
          _builder.append(_infoButton);
          _xifexpression = _builder.toString();
        } else {
          StringConcatenation _builder_1 = new StringConcatenation();
          String _defaultTypeSpec = this.getDefaultTypeSpec(param.getSchema());
          _builder_1.append(_defaultTypeSpec);
          CharSequence _infoButton_1 = det.getInfoButton();
          _builder_1.append(_infoButton_1);
          _xifexpression = _builder_1.toString();
        }
        _xblockexpression = _xifexpression;
      }
      return _xblockexpression;
    }
    
    @Override
    protected String getDoc() {
      String _description = this.obj.getDescription();
      String _docHtml = null;
      if (_description!=null) {
        _docHtml=this._docHelper.getDocHtml(_description);
      }
      return _docHtml;
    }
  }
  
  public static class ParametersStructureTable extends StructureTable> {
    public ParametersStructureTable(final List obj, final String[]... cols) {
      super(obj, cols);
    }
    
    @Override
    protected String render(final String name, final Object referrer, final Indentation ind) {
      String _xifexpression = null;
      boolean _isEmpty = this.obj.isEmpty();
      boolean _not = (!_isEmpty);
      if (_not) {
        StringConcatenation _builder = new StringConcatenation();
        {
          for(final Parameter param : this.obj) {
            String _renderObject = new StructureTable.ParameterStructureTable(param, this.cols).renderObject(null, referrer, ind.advance2());
            _builder.append(_renderObject);
          }
        }
        _xifexpression = _builder.toString();
      }
      return _xifexpression;
    }
    
    @Override
    protected String getTypeSpec(final AttrDetails det) {
      throw new UnsupportedOperationException("TODO: auto-generated method stub");
    }
    
    @Override
    protected String getDoc() {
      throw new UnsupportedOperationException("TODO: auto-generated method stub");
    }
  }
  
  public static class ExceptionStructureTable extends StructureTable {
    protected ExceptionStructureTable(final Exception obj, final String[]... cols) {
      super(obj, cols);
    }
    
    @Override
    protected String render(final String name, final Object referrer, final Indentation ind) {
      return this.defaultRender(name, referrer, ind, null);
    }
    
    @Override
    protected String getTypeSpec(final AttrDetails det) {
      return this.getTypeSpec(this.obj, det);
    }
    
    /**
     * Attempt to render nonsensical array
     */
    private String _getTypeSpec(final BadArrayException e, final AttrDetails det) {
      return "???[]";
    }
    
    private String _getTypeSpec(final BadReferenceException e, final AttrDetails det) {
      return "ref";
    }
    
    private String _getTypeSpec(final RecursiveRenderException e, final AttrDetails det) {
      return "(recursive)";
    }
    
    @Override
    protected String renderColumn(final String colAttr, final String name, final Object referrer, final Indentation ind, final AttrDetails det) {
      String _xifexpression = null;
      if ((this.obj instanceof RecursiveRenderException)) {
        _xifexpression = this.renderColumn(((RecursiveRenderException)this.obj), colAttr, name, referrer, ind, det);
      } else {
        _xifexpression = super.renderColumn(colAttr, name, referrer, ind, det);
      }
      return _xifexpression;
    }
    
    /**
     * Recursive rendering attempt
     */
    protected String renderColumn(final RecursiveRenderException e, final String colAttr, final String name, final Object referrer, final Indentation ind, final AttrDetails det) {
      String _xblockexpression = null;
      {
        final Object obj = this._refHelper.safeResolve(e.getObject());
        String _switchResult = null;
        if (colAttr != null) {
          switch (colAttr) {
            case "name":
              String _xblockexpression_1 = null;
              {
                final String tooltip = " ";
                String _htmlEscape = this._htmlHelper.htmlEscape(this.chooseName(obj, name));
                _xblockexpression_1 = this.indentCode((_htmlEscape + tooltip), ind);
              }
              _switchResult = _xblockexpression_1;
              break;
            case "type":
              String _typeSpec = this.getTypeSpec(det);
              String _code = null;
              if (_typeSpec!=null) {
                _code=this._htmlHelper.getCode(_typeSpec);
              }
              _switchResult = _code;
              break;
            default:
              _switchResult = this.getValueForDisplay(this._attributeHelper.getAttribute(obj, colAttr));
              break;
          }
        } else {
          _switchResult = this.getValueForDisplay(this._attributeHelper.getAttribute(obj, colAttr));
        }
        _xblockexpression = _switchResult;
      }
      return _xblockexpression;
    }
    
    @Override
    protected String getDoc() {
      return this.getDoc(this.obj);
    }
    
    private String _getDoc(final BadReferenceException e) {
      String _xblockexpression = null;
      {
        final String refString = e.getRefString().replaceAll("#/_UNRESOLVABLE/", "");
        StringConcatenation _builder = new StringConcatenation();
        _builder.append("Invalid Reference: ");
        String _htmlEscape = this._htmlHelper.htmlEscape(refString);
        _builder.append(_htmlEscape);
        _builder.append("");
        _xblockexpression = _builder.toString();
      }
      return _xblockexpression;
    }
    
    private String _getDoc(final BadArrayException e) {
      return e.getMessage();
    }
    
    private String getTypeSpec(final Exception e, final AttrDetails det) {
      if (e instanceof BadArrayException) {
        return _getTypeSpec((BadArrayException)e, det);
      } else if (e instanceof BadReferenceException) {
        return _getTypeSpec((BadReferenceException)e, det);
      } else if (e instanceof RecursiveRenderException) {
        return _getTypeSpec((RecursiveRenderException)e, det);
      } else {
        throw new IllegalArgumentException("Unhandled parameter types: " +
          Arrays.asList(e, det).toString());
      }
    }
    
    private String getDoc(final Exception e) {
      if (e instanceof BadArrayException) {
        return _getDoc((BadArrayException)e);
      } else if (e instanceof BadReferenceException) {
        return _getDoc((BadReferenceException)e);
      } else {
        throw new IllegalArgumentException("Unhandled parameter types: " +
          Arrays.asList(e).toString());
      }
    }
  }
  
  @Extension
  protected HtmlHelper _htmlHelper = HelperHelper.getHtmlHelper();
  
  @Extension
  protected AttributeHelper _attributeHelper = HelperHelper.getAttributeHelper();
  
  @Extension
  protected DocHelper _docHelper = HelperHelper.getDocHelper();
  
  @Extension
  private RecursionHelper _recursionHelper = HelperHelper.getRecursionHelper();
  
  @Extension
  protected ArrayHelper _arrayHelper = HelperHelper.getArrayHelper();
  
  @Extension
  protected RefHelper _refHelper = HelperHelper.getRefHelper();
  
  @Extension
  protected OptionHelper _optionHelper = HelperHelper.getOptionHelper();
  
  @Extension
  protected KaiZenParserHelper _kaiZenParserHelper = new KaiZenParserHelper();
  
  protected final String[][] cols;
  
  protected final T obj;
  
  protected StructureTable(final T obj, final String[]... cols) {
    this.cols = cols;
    this.obj = obj;
  }
  
  /**
   * Public method for rendering a table describing an object
   */
  public String render(final String name) {
    StringConcatenation _builder = new StringConcatenation();
    _builder.append("");
    _builder.newLine();
    _builder.append("    ");
    String _renderHeaderRow = this.renderHeaderRow();
    _builder.append(_renderHeaderRow, "    ");
    _builder.newLineIfNotEmpty();
    _builder.append("    ");
    Indentation _indentation = new Indentation();
    String _renderObject = this.renderObject(name, null, _indentation);
    _builder.append(_renderObject, "    ");
    _builder.newLineIfNotEmpty();
    _builder.append("
"); _builder.newLine(); return _builder.toString(); } protected String renderObject(final String name, final Object referrer, final Indentation ind) { String _xblockexpression = null; { Activation activation = null; String _xtrycatchfinallyexpression = null; try { String _xblockexpression_1 = null; { activation = this._recursionHelper.use(this.obj); _xblockexpression_1 = this.render(name, referrer, ind); } _xtrycatchfinallyexpression = _xblockexpression_1; } catch (final Throwable _t) { if (_t instanceof BadReferenceException) { final BadReferenceException e = (BadReferenceException)_t; _xtrycatchfinallyexpression = new StructureTable.ExceptionStructureTable(e, this.cols).render(name, referrer, ind); } else if (_t instanceof RecursiveRenderException) { final RecursiveRenderException e_1 = (RecursiveRenderException)_t; _xtrycatchfinallyexpression = new StructureTable.ExceptionStructureTable(e_1, this.cols).render(name, referrer, ind); } else if (_t instanceof BadArrayException) { final BadArrayException e_2 = (BadArrayException)_t; _xtrycatchfinallyexpression = new StructureTable.ExceptionStructureTable(e_2, this.cols).render(name, referrer, ind); } else { throw Exceptions.sneakyThrow(_t); } } finally { if (activation!=null) { activation.close(); } } _xblockexpression = _xtrycatchfinallyexpression; } return _xblockexpression; } protected String renderColumn(final String colAttr, final String name, final Object referrer, final Indentation ind, final AttrDetails det) { String _xblockexpression = null; { final String chosenName = this.chooseName(this.obj, name); String _switchResult = null; if (colAttr != null) { switch (colAttr) { case "name": String _htmlEscape = null; if (chosenName!=null) { _htmlEscape=this._htmlHelper.htmlEscape(chosenName); } String _formatName = null; if (_htmlEscape!=null) { _formatName=this.formatName(_htmlEscape, chosenName, this.obj, referrer); } String _indentCode = null; if (_formatName!=null) { _indentCode=this.indentCode(_formatName, ind); } _switchResult = _indentCode; break; case "type": String _typeSpec = this.getTypeSpec(det); String _code = null; if (_typeSpec!=null) { _code=this._htmlHelper.getCode(_typeSpec); } _switchResult = _code; break; case "doc": _switchResult = this.getDoc(); break; case "details": CharSequence _details = null; if (det!=null) { _details=det.details(false); } String _string = null; if (_details!=null) { _string=_details.toString(); } _switchResult = _string; break; default: _switchResult = this.getValueForDisplay(this._attributeHelper.getAttribute(this.obj, colAttr)); break; } } else { _switchResult = this.getValueForDisplay(this._attributeHelper.getAttribute(this.obj, colAttr)); } _xblockexpression = _switchResult; } return _xblockexpression; } protected abstract String render(final String name, final Object referrer, final Indentation ind); protected abstract String getTypeSpec(final AttrDetails det); protected abstract String getDoc(); protected String renderHeaderRow() { final Function1 _function = (String[] it) -> { return it[1]; }; return this.wrapHeaderRow(ListExtensions.map(((List)Conversions.doWrapArray(this.cols)), _function)); } protected String defaultRender(final String name, final Object referrer, final Indentation ind, final AttrDetails det) { StringConcatenation _builder = new StringConcatenation(); final Function1 _function = (String[] col) -> { return this.renderColumn(col[0], name, referrer, ind, det); }; String _wrapRow = this.wrapRow(ListExtensions.map(((List)Conversions.doWrapArray(this.cols)), _function)); _builder.append(_wrapRow); _builder.newLineIfNotEmpty(); String _renderAttrDetails = this.renderAttrDetails(name, referrer, ind, det); String _wrapRow_1 = null; if (_renderAttrDetails!=null) { _wrapRow_1=this.wrapRow(_renderAttrDetails, true); } _builder.append(_wrapRow_1); _builder.newLineIfNotEmpty(); return _builder.toString(); } private String renderAttrDetails(final String name, final Object referrer, final Indentation ind, final AttrDetails det) { return this.renderColumn("details", name, referrer, ind, det); } protected String _chooseName(final Object obj, final String offeredName) { String _xifexpression = null; if (((offeredName != null) && offeredName.startsWith("!"))) { _xifexpression = offeredName.substring(1); } else { String _rzveTypeName = this._attributeHelper.getRzveTypeName(obj); String _name = this._attributeHelper.getName(obj); final Function1 _function = (String it) -> { return Boolean.valueOf((it != null)); }; _xifexpression = IterableExtensions.last(IterableExtensions.filter(Collections.unmodifiableList(CollectionLiterals.newArrayList(offeredName, _rzveTypeName, _name)), _function)); } return _xifexpression; } private String formatName(final String formattedName, final String rawName, final Object obj, final Object referrer) { String _xifexpression = null; boolean _isRequired = this.isRequired(obj, rawName, referrer); if (_isRequired) { StringConcatenation _builder = new StringConcatenation(); _builder.append(""); _builder.append(formattedName); _builder.append(""); _xifexpression = _builder.toString(); } else { StringConcatenation _builder_1 = new StringConcatenation(); _builder_1.append(""); _builder_1.append(formattedName); _builder_1.append(""); _xifexpression = _builder_1.toString(); } return _xifexpression; } private boolean isRequired(final Object obj, final String name, final Object referrer) { boolean _matched = false; if (obj instanceof Parameter) { _matched=true; return ((Parameter)obj).isRequired(); } if (!_matched) { if (obj instanceof Schema) { _matched=true; return this.getRequiredProperties(referrer).contains(name); } } throw new IllegalArgumentException( "Named item is represented by neither a Property, a Parameter, nor a Model"); } private List getRequiredProperties(final Object referrer) { if ((referrer != null)) { boolean _matched = false; if (referrer instanceof Schema) { _matched=true; return IterableExtensions.toList(((Schema)referrer).getRequiredFields()); } } return Collections.unmodifiableList(CollectionLiterals.newArrayList()); } protected String getDefaultTypeSpec(final Schema obj) { String _kaiZenSchemaName = this._kaiZenParserHelper.getKaiZenSchemaName(obj); String _type = obj.getType(); String _rzveTypeName = this._attributeHelper.getRzveTypeName(obj); final Function1 _function = (String it) -> { return Boolean.valueOf((it != null)); }; return IterableExtensions.last(IterableExtensions.filter(Collections.unmodifiableList(CollectionLiterals.newArrayList(_kaiZenSchemaName, _type, _rzveTypeName)), _function)); } /** * All other property types (properties with primitive types) */ protected String _chooseName(final Parameter param, final String offeredName) { return param.getName(); } /** * Unresolvable Ref */ protected String _chooseName(final BadReferenceException e, final String offeredName) { String _xifexpression = null; if (((offeredName != null) && offeredName.startsWith("!"))) { _xifexpression = offeredName.substring(1); } else { _xifexpression = offeredName; } return _xifexpression; } /** * Utility methods */ private String wrapRow(final String value, final boolean noBorder) { return this.wrapRow(Collections.unmodifiableList(CollectionLiterals.newArrayList(value)), noBorder); } private String wrapRow(final List values) { return this.wrapRow(values, false); } private String wrapRow(final List values, final boolean noBorder) { String _xblockexpression = null; { String _xifexpression = null; if (noBorder) { _xifexpression = " style=\"border-top:0px\""; } final String style = _xifexpression; StringConcatenation _builder = new StringConcatenation(); _builder.append(""); { for(final String value : values) { _builder.append(""); _builder.append(value); _builder.append(""); } } _builder.append(""); _xblockexpression = _builder.toString(); } return _xblockexpression; } protected String wrapHeaderRow(final List values) { StringConcatenation _builder = new StringConcatenation(); _builder.append(""); { for(final String value : values) { _builder.append(""); _builder.append(value); _builder.append(""); } } _builder.append(""); return _builder.toString(); } public CharSequence getColSpan(final List values) { CharSequence _xifexpression = null; if (((values.size() == 1) && (((List)Conversions.doWrapArray(this.cols)).size() > 1))) { StringConcatenation _builder = new StringConcatenation(); _builder.append(" "); _builder.append("colspan=\""); int _size = ((List)Conversions.doWrapArray(this.cols)).size(); _builder.append(_size, " "); _builder.append("\""); _xifexpression = _builder; } return _xifexpression; } protected String indentTextToCode(final String s, final Indentation ind) { String _xblockexpression = null; { ind.use1(); int _n1 = ind.getN1(); int _n2 = ind.getN2(); int _plus = (_n1 + _n2); String _samp = this._htmlHelper.getSamp(this.getIndentation(_plus)); _xblockexpression = (_samp + s); } return _xblockexpression; } protected String indentCode(final String s, final Indentation ind) { String _xblockexpression = null; { ind.use1(); ind.use2(); String _samp = this._htmlHelper.getSamp(this.getIndentation(ind.getN1())); String _indentation = this.getIndentation(ind.getN2()); String _code = this._htmlHelper.getCode((_indentation + s)); _xblockexpression = (_samp + _code); } return _xblockexpression; } private String getIndentation(final int n) { return StringUtils.repeat("  ", n); } protected String getValueForDisplay(final Object o) { String _formatValue = null; if (o!=null) { _formatValue=this.formatValue(o); } return _formatValue; } private String _formatValue(final String s) { String _htmlEscape = null; if (s!=null) { _htmlEscape=this._htmlHelper.htmlEscape(s); } return _htmlEscape; } private String _formatValue(final List list) { StringConcatenation _builder = new StringConcatenation(); { boolean _hasElements = false; for(final Object item : list) { if (!_hasElements) { _hasElements = true; } else { _builder.appendImmediate("
", ""); } _builder.append("item?.toString?.htmlEscape"); } } return _builder.toString(); } protected String chooseName(final Object e, final String offeredName) { if (e instanceof BadReferenceException) { return _chooseName((BadReferenceException)e, offeredName); } else if (e instanceof Parameter) { return _chooseName((Parameter)e, offeredName); } else if (e != null) { return _chooseName(e, offeredName); } else { throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.asList(e, offeredName).toString()); } } private String formatValue(final Object list) { if (list instanceof List) { return _formatValue((List)list); } else if (list instanceof String) { return _formatValue((String)list); } else { throw new IllegalArgumentException("Unhandled parameter types: " + Arrays.asList(list).toString()); } } }