PmAttrUtil { @SuppressWarnings("unchecked") public static void resetBackingValueToDefault(PmAttr<?>... attr) { for (PmAttr<?> a : attr) { PmAttrBase<Object, Object> ab = (PmAttrBase<Object, Object>) a; if (isBackingValueWriteable(ab)) { Object defaultVal = ab.getDefaultValue(); Object defaultBackingVal = valueToBackingValue(ab, defaultVal); if (defaultBackingVal == null && getMetaData(ab).primitiveType) { throw new PmRuntimeException(ab, "Can't assign a null default value to a primitive value type. Please define a valid default value."); } ab.setBackingValue(defaultBackingVal); } } }  @SuppressWarnings("unchecked") static void resetBackingValueToDefault(PmAttr<?>... attr); static void resetBackingValuesToDefault(PmObject rootPm); @SuppressWarnings("unchecked") static boolean isEmptyValue(PmAttr<?> pmAttr, Object value); @SuppressWarnings("unchecked") static T getBackingValue(PmAttr<?> pmAttr); static T_VALUE backingValueToValue(PmAttrBase<T_VALUE, T_BACKING_VALUE> pmAttrCtxt, T_BACKING_VALUE backingValue); static T_BACKING_VALUE valueToBackingValue(PmAttrBase<T_VALUE, T_BACKING_VALUE> pmAttrCtxt, T_VALUE value); static T_VALUE convertStringToValue(PmAttr<T_VALUE> pmAttrCtxt, String s); static String convertValueToString(PmAttr<T_VALUE> pmAttrCtxt, T_VALUE value); @Deprecated static T_VALUE convertBackingValue(PmAttrBase<T_VALUE, T_BACKING_VALUE> pmAttrCtxt, T_BACKING_VALUE backingValue); @Deprecated static T_BACKING_VALUE convertExternalValue(PmAttrBase<T_VALUE, T_BACKING_VALUE> pmAttrCtxt, T_VALUE value);  }
@Test public void testResetBackingValueToDefault() { PmAttrUtil.resetBackingValueToDefault(testPm.s, testPm.sWithDefault); assertEquals(null, testPm.s.getValue()); assertEquals(null, testPm.s.getBackingValue()); assertEquals("DEFAULT", testPm.sWithDefault.getBackingValue()); assertEquals("DEFAULT", testPm.sWithDefault.getValue()); }