I have simple question. I already know that in Java you can't do sth like:
Long.class.cast(and Integer here)
but I am just curious why? In the opposite way you can easily get into overflow, but this way I can't find anything bad which can happen. Can anyone tell me what is wrong in using casting that way?
EDIT->
So what I am trying to do. I have already wrote a converter which converts me from my provided input(it is a Map) to my model. I wanted to write 1 converter for every model which I specify. Currently, it works for objects inside it(such as other models which I provided), strings, and the same types(for example I have got an integer and I provide an integer). What I am trying to do, I want to 'update' my converter to work in such cases like: in my model I have a field of type Long, and I provided Integer. So I want it to convert Integer to Long, however, I don't want to make if only for that case(because in such situation for example converting from Short to Long would be another if). Is it possible?