[AESH-245] Extract inner class and start refactore in class

I sent new PR because is more easy to correct code format problem to me.
But, we need see the aesh code formatter. The eclipse format not compatible with intellij format.