com.hazelcast.org.jsfr.json.provider.CastUtil Maven / Gradle / Ivy
package com.hazelcast.org.jsfr.json.provider;
final class CastUtil {
private CastUtil() {
}
static T castJavaObject(Object value, Class tClass) {
if (tClass.isInstance(value) || value == null) {
return tClass.cast(value);
} else if (tClass == String.class) {
return tClass.cast(value.toString());
} else {
throw new ClassCastException("Cannot cast " + value.getClass().getName() + " to " + tClass.getName());
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy