Check type of primitive field

后端 未结 4 1503
野性不改
野性不改 2020-12-02 22:29

I\'m trying to determine the type of a field on an object. I don\'t know the type of the object when it is passed to me but I need to find fields which are long

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-02 22:58

    You're using the wrong constant to check for Long primitives - use Long.TYPE, each other primitive type can be found with a similarly named constant on the wrapper. eg: Byte.TYPE, Character.TYPE, etc.

提交回复
热议问题