@Test public void testResetTransiantOnDatasetMatadataFavorites() { TransientTestObject obj = new TransientTestObject(); inMemoryDataSetMetadataRepository.resetTransientValues(obj); assertTrue(Defaults.defaultValue(boolean.class).equals(obj.zeBoolean)); assertTrue(Defaults.defaultValue(char.class).equals(obj.zeChar)); assertTrue(Defaults.defaultValue(byte.class).equals(obj.zeByte)); assertTrue(Defaults.defaultValue(short.class).equals(obj.zeShort)); assertTrue(Defaults.defaultValue(int.class).equals(obj.zeInt)); assertTrue(Defaults.defaultValue(float.class).equals(obj.zeFloat)); assertTrue(Defaults.defaultValue(double.class).equals(obj.zeDouble)); assertTrue(obj.zeObject == Defaults.defaultValue(Object.class)); assertTrue(Defaults.defaultValue(boolean.class).equals(TransientTestObject.zeStaticBoolean)); }
void resetTransientValues(Object zeObject) { if (zeObject != null) { Field[] fields = zeObject.getClass().getDeclaredFields(); for (Field field : fields) { if (Modifier.isTransient(field.getModifiers()) && !field.getName().endsWith("jacocoData")) { Object defaultValue = Defaults.defaultValue(field.getType()); field.setAccessible(true); try { field.set(zeObject, defaultValue); } catch (IllegalArgumentException | IllegalAccessException e) { LOG.error("failed to reset the transient field [" + field + "] before storage", e); } } } } }
InMemoryDataSetMetadataRepository extends ObjectDataSetMetadataRepository { void resetTransientValues(Object zeObject) { if (zeObject != null) { Field[] fields = zeObject.getClass().getDeclaredFields(); for (Field field : fields) { if (Modifier.isTransient(field.getModifiers()) && !field.getName().endsWith("jacocoData")) { Object defaultValue = Defaults.defaultValue(field.getType()); field.setAccessible(true); try { field.set(zeObject, defaultValue); } catch (IllegalArgumentException | IllegalAccessException e) { LOG.error("failed to reset the transient field [" + field + "] before storage", e); } } } } } }
InMemoryDataSetMetadataRepository extends ObjectDataSetMetadataRepository { void resetTransientValues(Object zeObject) { if (zeObject != null) { Field[] fields = zeObject.getClass().getDeclaredFields(); for (Field field : fields) { if (Modifier.isTransient(field.getModifiers()) && !field.getName().endsWith("jacocoData")) { Object defaultValue = Defaults.defaultValue(field.getType()); field.setAccessible(true); try { field.set(zeObject, defaultValue); } catch (IllegalArgumentException | IllegalAccessException e) { LOG.error("failed to reset the transient field [" + field + "] before storage", e); } } } } }  }
InMemoryDataSetMetadataRepository extends ObjectDataSetMetadataRepository { void resetTransientValues(Object zeObject) { if (zeObject != null) { Field[] fields = zeObject.getClass().getDeclaredFields(); for (Field field : fields) { if (Modifier.isTransient(field.getModifiers()) && !field.getName().endsWith("jacocoData")) { Object defaultValue = Defaults.defaultValue(field.getType()); field.setAccessible(true); try { field.set(zeObject, defaultValue); } catch (IllegalArgumentException | IllegalAccessException e) { LOG.error("failed to reset the transient field [" + field + "] before storage", e); } } } } }  @Override Stream<DataSetMetadata> source(); @Override void save(DataSetMetadata dataSetMetadata); @Override DataSetMetadata get(String id); @Override void remove(String id); }
InMemoryDataSetMetadataRepository extends ObjectDataSetMetadataRepository { void resetTransientValues(Object zeObject) { if (zeObject != null) { Field[] fields = zeObject.getClass().getDeclaredFields(); for (Field field : fields) { if (Modifier.isTransient(field.getModifiers()) && !field.getName().endsWith("jacocoData")) { Object defaultValue = Defaults.defaultValue(field.getType()); field.setAccessible(true); try { field.set(zeObject, defaultValue); } catch (IllegalArgumentException | IllegalAccessException e) { LOG.error("failed to reset the transient field [" + field + "] before storage", e); } } } } }  @Override Stream<DataSetMetadata> source(); @Override void save(DataSetMetadata dataSetMetadata); @Override DataSetMetadata get(String id); @Override void remove(String id);  }