@Test public void testDateIsCloneable() { assertNotNull(SimpleObjectCopyFactory.extractPublicClone(Date.class)); }
static Method extractPublicClone(Class<?> clazz) { if (Cloneable.class.isAssignableFrom(clazz)) { Method m = null; try { m = clazz.getMethod("clone"); if (Modifier.isPublic(m.getModifiers())) { return m; } } catch (NoSuchMethodException e) { } } return null; }
SimpleObjectCopyFactory implements ObjectCopyFactory { static Method extractPublicClone(Class<?> clazz) { if (Cloneable.class.isAssignableFrom(clazz)) { Method m = null; try { m = clazz.getMethod("clone"); if (Modifier.isPublic(m.getModifiers())) { return m; } } catch (NoSuchMethodException e) { } } return null; } }
SimpleObjectCopyFactory implements ObjectCopyFactory { static Method extractPublicClone(Class<?> clazz) { if (Cloneable.class.isAssignableFrom(clazz)) { Method m = null; try { m = clazz.getMethod("clone"); if (Modifier.isPublic(m.getModifiers())) { return m; } } catch (NoSuchMethodException e) { } } return null; }  }
SimpleObjectCopyFactory implements ObjectCopyFactory { static Method extractPublicClone(Class<?> clazz) { if (Cloneable.class.isAssignableFrom(clazz)) { Method m = null; try { m = clazz.getMethod("clone"); if (Modifier.isPublic(m.getModifiers())) { return m; } } catch (NoSuchMethodException e) { } } return null; }  @Override ObjectTransformer<T, T> createCopyTransformer(Class<T> clazz); @SuppressWarnings("unchecked") @Override ObjectTransformer<T, T> createCopyTransformer(
    Class<T> clazz, ClassLoader classLoader); }
SimpleObjectCopyFactory implements ObjectCopyFactory { static Method extractPublicClone(Class<?> clazz) { if (Cloneable.class.isAssignableFrom(clazz)) { Method m = null; try { m = clazz.getMethod("clone"); if (Modifier.isPublic(m.getModifiers())) { return m; } } catch (NoSuchMethodException e) { } } return null; }  @Override ObjectTransformer<T, T> createCopyTransformer(Class<T> clazz); @SuppressWarnings("unchecked") @Override ObjectTransformer<T, T> createCopyTransformer(
    Class<T> clazz, ClassLoader classLoader);  }