@Test public void isPrimitive_A$String() throws Exception { String[] args = new String[] { "byte", "short", "int", "long", "char", "float", "double", "boolean", "void", "dummy" }; boolean[] expected = new boolean[] { true, true, true, true, true, true, true, true, true, false }; for (int i = 0; i < args.length; i++) { boolean actual = PrimitiveTypeUtil.isPrimitive(args[i]); assertEquals(expected[i], actual); } }
public static final boolean isPrimitive(String typeName) { Assertion.on("typeName").mustNotBeEmpty(typeName); if (typeName == null) return false; if (typeName.equals("byte")) return true; if (typeName.equals("short")) return true; if (typeName.equals("int")) return true; if (typeName.equals("long")) return true; if (typeName.equals("char")) return true; if (typeName.equals("float")) return true; if (typeName.equals("double")) return true; if (typeName.equals("boolean")) return true; if (typeName.equals("void")) return true; return false; }
PrimitiveTypeUtil { public static final boolean isPrimitive(String typeName) { Assertion.on("typeName").mustNotBeEmpty(typeName); if (typeName == null) return false; if (typeName.equals("byte")) return true; if (typeName.equals("short")) return true; if (typeName.equals("int")) return true; if (typeName.equals("long")) return true; if (typeName.equals("char")) return true; if (typeName.equals("float")) return true; if (typeName.equals("double")) return true; if (typeName.equals("boolean")) return true; if (typeName.equals("void")) return true; return false; } }
PrimitiveTypeUtil { public static final boolean isPrimitive(String typeName) { Assertion.on("typeName").mustNotBeEmpty(typeName); if (typeName == null) return false; if (typeName.equals("byte")) return true; if (typeName.equals("short")) return true; if (typeName.equals("int")) return true; if (typeName.equals("long")) return true; if (typeName.equals("char")) return true; if (typeName.equals("float")) return true; if (typeName.equals("double")) return true; if (typeName.equals("boolean")) return true; if (typeName.equals("void")) return true; return false; } private  PrimitiveTypeUtil(); }
PrimitiveTypeUtil { public static final boolean isPrimitive(String typeName) { Assertion.on("typeName").mustNotBeEmpty(typeName); if (typeName == null) return false; if (typeName.equals("byte")) return true; if (typeName.equals("short")) return true; if (typeName.equals("int")) return true; if (typeName.equals("long")) return true; if (typeName.equals("char")) return true; if (typeName.equals("float")) return true; if (typeName.equals("double")) return true; if (typeName.equals("boolean")) return true; if (typeName.equals("void")) return true; return false; } private  PrimitiveTypeUtil(); static final boolean isPrimitive(String typeName); static final Class<?> getPrimitiveClass(String typeName); static final String getTypeDefaultValue(String typeName); }
PrimitiveTypeUtil { public static final boolean isPrimitive(String typeName) { Assertion.on("typeName").mustNotBeEmpty(typeName); if (typeName == null) return false; if (typeName.equals("byte")) return true; if (typeName.equals("short")) return true; if (typeName.equals("int")) return true; if (typeName.equals("long")) return true; if (typeName.equals("char")) return true; if (typeName.equals("float")) return true; if (typeName.equals("double")) return true; if (typeName.equals("boolean")) return true; if (typeName.equals("void")) return true; return false; } private  PrimitiveTypeUtil(); static final boolean isPrimitive(String typeName); static final Class<?> getPrimitiveClass(String typeName); static final String getTypeDefaultValue(String typeName);  }