private static Set < TsBeanModel > writeBeanAndParentsFieldSpecs ( Writer writer , Settings settings , TsModel model , Set < TsBeanModel > emittedSoFar , TsBeanModel bean ) { if ( emittedSoFar . contains ( bean ) ) { return new HashSet <> ( ) ; } final TsBeanModel parentBean = getBeanModelByType ( model , bean . getParent ( ) ) ; final Set < TsBeanModel > emittedBeans = parentBean != null ? writeBeanAndParentsFieldSpecs ( writer , settings , model , emittedSoFar , parentBean ) : new HashSet < TsBeanModel > ( ) ; final String parentClassName = parentBean != null ? getBeanModelClassName ( parentBean ) + "Fields" : "Fields" ; writer . writeIndentedLine ( "" ) ; writer . writeIndentedLine ( "class " + getBeanModelClassName ( bean ) + "Fields extends " + parentClassName + " {" ) ; writer . writeIndentedLine ( settings . indentString + "constructor(parent?: Fields, name?: string) { super(parent, name); }" ) ; for ( TsPropertyModel property : bean . getProperties ( ) ) { writeBeanProperty ( writer , settings , model , bean , property ) ; } writer . writeIndentedLine ( "}" ) ; emittedBeans . add ( bean ) ; return emittedBeans ; }
Emits a bean and its parent beans before if needed . Returns the list of beans that were emitted .