Added generics, modified the factory to use getInstance if no
constructor is found, and changed the Parser to check before casting an
object to a component.