@Test public void testToString02() { assertEquals("2,4,8,16,32", ToString(Array(2, 4, 8, 16, 32))); Object myobj1 = new Object() { @SuppressWarnings("unused") public double toNumber() { return 12345; } public String toString() { return "67890"; } @SuppressWarnings("unused") public String valueOf() { return "[object MyObj]"; } }; assertEquals("67890", ToString(myobj1)); }
static String ToString(Object arg) { if (arg == null) { return "null"; } else if (Boolean.TRUE.equals(arg)) { return "true"; } else if (Boolean.FALSE.equals(arg)) { return "false"; } else if (arg instanceof String) { return (String) arg; } else if (arg instanceof Number) { return ToString((Number) arg); } Object primValue = ToPrimitive(arg, "String"); return ToString(primValue); }
JSAbstractOperations { static String ToString(Object arg) { if (arg == null) { return "null"; } else if (Boolean.TRUE.equals(arg)) { return "true"; } else if (Boolean.FALSE.equals(arg)) { return "false"; } else if (arg instanceof String) { return (String) arg; } else if (arg instanceof Number) { return ToString((Number) arg); } Object primValue = ToPrimitive(arg, "String"); return ToString(primValue); } }
JSAbstractOperations { static String ToString(Object arg) { if (arg == null) { return "null"; } else if (Boolean.TRUE.equals(arg)) { return "true"; } else if (Boolean.FALSE.equals(arg)) { return "false"; } else if (arg instanceof String) { return (String) arg; } else if (arg instanceof Number) { return ToString((Number) arg); } Object primValue = ToPrimitive(arg, "String"); return ToString(primValue); }  }
JSAbstractOperations { static String ToString(Object arg) { if (arg == null) { return "null"; } else if (Boolean.TRUE.equals(arg)) { return "true"; } else if (Boolean.FALSE.equals(arg)) { return "false"; } else if (arg instanceof String) { return (String) arg; } else if (arg instanceof Number) { return ToString((Number) arg); } Object primValue = ToPrimitive(arg, "String"); return ToString(primValue); }   }
JSAbstractOperations { static String ToString(Object arg) { if (arg == null) { return "null"; } else if (Boolean.TRUE.equals(arg)) { return "true"; } else if (Boolean.FALSE.equals(arg)) { return "false"; } else if (arg instanceof String) { return (String) arg; } else if (arg instanceof Number) { return ToString((Number) arg); } Object primValue = ToPrimitive(arg, "String"); return ToString(primValue); }   static final BigInteger UINT_MAX_VALUE; static final Double UINT_MAX_VALUE_D; static final BigInteger SINT_MAX_VALUE; static final BigInteger USHORT_MAX_VALUE; }