determine adapter class in a better way