package Ġcom . github . dim su z . model generator . processor Ċ Ċ import Ġcom . github . dim su z . model generator . Model Generator Ċ import Ġcom . github . dim su z . model generator . processor . entity . Either Ċ import Ġcom . github . dim su z . model generator . processor . entity . Reactive Model Description Ċ import Ġcom . github . dim su z . model generator . processor . util . enc lo sing PackageName Ċ import Ġcom . github . dim su z . model generator . processor . util . writeFile Ċ import Ġcom . squareup . kotlin po et . File Spec Ċ import Ġcom . squareup . kotlin po et . Fun Spec Ċ import Ġcom . squareup . kotlin po et . K Modifier Ċ import Ġcom . squareup . kotlin po et . Type Spec Ċ import Ġcom . squareup . kotlin po et . as ClassName Ċ import Ġjavax . annotation . processing . Processing Environment Ċ Ċ internal Ġfun Ġgenerate Factory Extension ( ĊĠ Ġmodel Description : ĠReactive Model Description , ĊĠ Ġmodel Type Spec : ĠType Spec , ĊĠ Ġprocessing Env : ĠProcessing Environment Ċ ): ĠEither < String , ĠUnit > Ġ{ ĊĠ Ġval Ġconstructor Call Args Ġ= Ġmodel Type Spec . primary Constructor !!. parameters . map Ġ{ Ġit . name Ġ} ĊĠĠĠ Ġ. join ToString (", Ġ") ĊĠ Ġval Ġfile Spec Ġ= ĠFile Spec ĊĠĠĠ Ġ. builder ( model Description . model Element . enc lo sing PackageName , Ġ"${ Model Generator :: class . simple Name } Extensions . kt ") ĊĠĠĠ Ġ. addFunction ( Fun Spec . builder (" create Model ") ĊĠĠĠĠĠ Ġ. add Parameters ( model Type Spec . primary Constructor !!. parameters ) ĊĠĠĠĠĠ Ġ. add Modifiers ( K Modifier . INTERNAL ) ĊĠĠĠĠĠ Ġ. receiver ( Model Generator :: class ) ĊĠĠĠĠĠ Ġ. add Statement (" return Ġ% T ($ constructor Call Args )", Ġmodel Description . className ) ĊĠĠĠĠĠ Ġ. returns ( model Description . model Element . as ClassName ()) ĊĠĠĠĠĠ Ġ. build ()) ĊĠĠĠ Ġ. build () ĊĠ Ġreturn Ġwrite File ( processing Env , Ġfile Spec ) Ċ } Ċ