Split the HUGE generate method into different methods.

Split generate method. Will be easier to understand / test in the futur. Seperate responsibilities into various methods.

generate method will now call the following methods :
* getPossibleTypes : get possible sub-types for encoding/decoding
* generateSingleton : write the instantiation of the singleton
* generateEncodeMethod : write the encode method
    * generateEnumEncodeMethod : write the encode method for an enum class type
* generateDecodeMethod : write the decode method
    * generateEnumDecodeMethod : write the decode method for an enum class type