
=== HEADER ===

=== BODY ===

  
  let testClass = ->first(.eContents(self, EClass)) in
    comment: // Class 1 has a single property of a simple type, e.g. a bool
    [query: .createClassRows(2, testClass)]
  endfor
  
  comment: // testClass
  
=== FOOTER ===

=== TEMPLATES ===

template createPropertyRow (level : java.lang.Integer, property : EStructuralFeature)
  table
    row
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
        
      
    
  comment: TODO : IF THE FOLLOWING NEWLINE IS REMOVED a NullPointerException is generated (https://forum.mbse-capella.org/t/m2doc-3-1-0-npe-in-a-template/4316)

template createClassRows (level : java.lang.Integer, elem : EClass)
  
  for prop | .aqlFeatureAccess(elem, 'eAllStructuralFeatures') do
    
    if .and(.oclIsTypeOf(.aqlFeatureAccess(prop, 'eType'), EClass), .greaterThan(level, 0)) then
      [query: .createClassRows(.sub(level, 1), .oclAsType(.aqlFeatureAccess(prop, 'eType'), EClass))]
    else
      comment: // simple type
      [query: .createPropertyRow(level, prop)]
       
    endif
    
    comment: // class/complex or simple type
  endfor
  
  comment: prop