T
The Abrasive Sponge
Shouldn't this work?
//Source Java 1.5/5.0
public class AssignableFromTest {
/** Creates a new instance of AssignableFromTest */
public AssignableFromTest() {
}
private static boolean isStandardProperty(Class<?> clazz) {
if (clazz.isPrimitive()) return true;
if (clazz.isAssignableFrom(Number.class)) return true;
if (clazz.isAssignableFrom(Character.class)) return true;
if (clazz.isAssignableFrom(String.class)) return true;
return false;
}
public static void main(String... args) {
Byte b = new Byte("0");
System.out.println(isStandardProperty(b.getClass())); //false?
Integer i = 4;
System.out.println(isStandardProperty(i.getClass())); //false?
}
}
//Source Java 1.5/5.0
public class AssignableFromTest {
/** Creates a new instance of AssignableFromTest */
public AssignableFromTest() {
}
private static boolean isStandardProperty(Class<?> clazz) {
if (clazz.isPrimitive()) return true;
if (clazz.isAssignableFrom(Number.class)) return true;
if (clazz.isAssignableFrom(Character.class)) return true;
if (clazz.isAssignableFrom(String.class)) return true;
return false;
}
public static void main(String... args) {
Byte b = new Byte("0");
System.out.println(isStandardProperty(b.getClass())); //false?
Integer i = 4;
System.out.println(isStandardProperty(i.getClass())); //false?
}
}