Simple method to attach user data in ui elements

I've found useful in my project to have these methods to retrieve data from a widget in my listeners . i.e. instead to use "if elseif else "to detect which button was pressed and then goto the corresponding screen , i've attached the screen to a button and then, in listener, simple setScreen((Screen)button.getUserData()) .