class java.lang.Integer cannot be cast to class java.lang.Long code example
Example 1: java.lang.long cannot be cast to java.lang.integer
Long.valueOf(x).intValue()
Example 2: java.lang.long cannot be cast to java.lang.integer
Integer.valueOf(x).longValue()
Example 3: class java.lang.Integer cannot be cast to class java.lang.Long (java.lang.Integer and java.lang.Long are in module java.base of loader 'bootstrap')
// on my case, instead of casting I did:
Long variable = Long.valueOf(variable.get("Attribute").toString());