Split the HUGE generate method into different methods.

Split generete method. Will be easier to understand / test in the futur. Seperate responsibilities into various methods.

generate
* 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