I use red5 and setting/getting attributes using the IConnection class, but that's really not relevant.
'L' means long in java. so 0L is 0 type Long instead of just '0' which is 0 type Integer.
What is the difference between [Ljava.lang.Long and java.lang.Long in the following error message:
stack trace: java.lang.ClassCastException: [Ljava.lang.Long; cannot be cast to java.lang.Long
update
code sample:
static Long getLongAttribute(IConnection conn, String attribute) {
Long result=null;
try {
if (!conn.hasAttribute(attribute))
throw new Exception(attribute + " - Long attribute not found!");
result = conn.getLongAttribute(attribute); //
} catch (Exception e) {
_handleException(e);
}
return result;
}
解决方案
The first object is array of Long, the second is just Long. Try this
Long l = 1l;
Long[] l2 = {};
System.out.println(l.getClass());
System.out.println(l2.getClass());
Output
class java.lang.Long
class [Ljava.lang.Long;
But I do agree that [L_class_; presentation for array types is highly confusing. I wonder how it came to be that way.