added missing Javadoc tags for type parameters
added missing Javadoc return tag
refactored to reduced complexity in generation logic