@Test public void testGetWritableObject() throws Exception { assertNull(MySQLCDCUtils.getWritableObject(null, null)); assertNull(MySQLCDCUtils.getWritableObject(Types.INTEGER, null)); assertEquals((byte) 1, MySQLCDCUtils.getWritableObject(Types.INTEGER, (byte) 1)); assertEquals("Hello", MySQLCDCUtils.getWritableObject(Types.VARCHAR, "Hello".getBytes())); }
public static Object getWritableObject(Integer type, Serializable value) { if (value == null) { return null; } if (type == null) { if (value instanceof byte[]) { return new String((byte[]) value); } else if (value instanceof Number) { return value; } } else if (value instanceof Number) { return value; } else { if (value instanceof byte[]) { return new String((byte[]) value); } else { return value.toString(); } } return null; }
MySQLCDCUtils { public static Object getWritableObject(Integer type, Serializable value) { if (value == null) { return null; } if (type == null) { if (value instanceof byte[]) { return new String((byte[]) value); } else if (value instanceof Number) { return value; } } else if (value instanceof Number) { return value; } else { if (value instanceof byte[]) { return new String((byte[]) value); } else { return value.toString(); } } return null; } }
MySQLCDCUtils { public static Object getWritableObject(Integer type, Serializable value) { if (value == null) { return null; } if (type == null) { if (value instanceof byte[]) { return new String((byte[]) value); } else if (value instanceof Number) { return value; } } else if (value instanceof Number) { return value; } else { if (value instanceof byte[]) { return new String((byte[]) value); } else { return value.toString(); } } return null; }  }
MySQLCDCUtils { public static Object getWritableObject(Integer type, Serializable value) { if (value == null) { return null; } if (type == null) { if (value instanceof byte[]) { return new String((byte[]) value); } else if (value instanceof Number) { return value; } } else if (value instanceof Number) { return value; } else { if (value instanceof byte[]) { return new String((byte[]) value); } else { return value.toString(); } } return null; }  static Object getWritableObject(Integer type, Serializable value); }
MySQLCDCUtils { public static Object getWritableObject(Integer type, Serializable value) { if (value == null) { return null; } if (type == null) { if (value instanceof byte[]) { return new String((byte[]) value); } else if (value instanceof Number) { return value; } } else if (value instanceof Number) { return value; } else { if (value instanceof byte[]) { return new String((byte[]) value); } else { return value.toString(); } } return null; }  static Object getWritableObject(Integer type, Serializable value);  }