@Test public void testArrayOfDates() { ArrayProperty property = getArrayProperty(DateType.INSTANCE); String myTestDate = "2017-11-29T12:30-03:44"; Date date = DateParser.parseW3CDateTime(myTestDate); Calendar cal = Calendar.getInstance(); cal.setTime(date); property.setValue(new Object[] { null, cal, date, myTestDate }); assertArrayEquals(new Object[] { null, cal, cal, cal }, (Calendar[]) property.getValue()); Calendar calWithCorrectTimezone = GregorianCalendar.from(ZonedDateTime.parse(myTestDate)); assertNotEquals(cal, calWithCorrectTimezone); property.setValue(new Object[] { null, calWithCorrectTimezone }); assertArrayEquals(new Object[] { null, calWithCorrectTimezone }, (Calendar[]) property.getValue()); }
@Override public void setValue(Object value) throws PropertyException { if (value == null) { childDirty = new boolean[0]; super.setValue(null); } else { Object[] oldValues = (Object[]) internalGetValue(); boolean[] oldChildDirty = getChildDirty(); super.setValue(value); Object[] newValues = (Object[]) internalGetValue(); boolean[] newChildDirty = new boolean[newValues != null ? newValues.length : 0]; for (int i = 0; i < newChildDirty.length; i++) { Object newValue = newValues[i]; if (oldValues == null || i >= oldValues.length) { newChildDirty[i] = true; } else { Object oldValue = oldValues[i]; if (!((newValue == null && oldValue == null) || (newValue != null && newValue.equals(oldValue)))) { newChildDirty[i] = true; } else { newChildDirty[i] = false || oldChildDirty[i]; } } } childDirty = newChildDirty; } }
ArrayProperty extends ScalarProperty { @Override public void setValue(Object value) throws PropertyException { if (value == null) { childDirty = new boolean[0]; super.setValue(null); } else { Object[] oldValues = (Object[]) internalGetValue(); boolean[] oldChildDirty = getChildDirty(); super.setValue(value); Object[] newValues = (Object[]) internalGetValue(); boolean[] newChildDirty = new boolean[newValues != null ? newValues.length : 0]; for (int i = 0; i < newChildDirty.length; i++) { Object newValue = newValues[i]; if (oldValues == null || i >= oldValues.length) { newChildDirty[i] = true; } else { Object oldValue = oldValues[i]; if (!((newValue == null && oldValue == null) || (newValue != null && newValue.equals(oldValue)))) { newChildDirty[i] = true; } else { newChildDirty[i] = false || oldChildDirty[i]; } } } childDirty = newChildDirty; } } }
ArrayProperty extends ScalarProperty { @Override public void setValue(Object value) throws PropertyException { if (value == null) { childDirty = new boolean[0]; super.setValue(null); } else { Object[] oldValues = (Object[]) internalGetValue(); boolean[] oldChildDirty = getChildDirty(); super.setValue(value); Object[] newValues = (Object[]) internalGetValue(); boolean[] newChildDirty = new boolean[newValues != null ? newValues.length : 0]; for (int i = 0; i < newChildDirty.length; i++) { Object newValue = newValues[i]; if (oldValues == null || i >= oldValues.length) { newChildDirty[i] = true; } else { Object oldValue = oldValues[i]; if (!((newValue == null && oldValue == null) || (newValue != null && newValue.equals(oldValue)))) { newChildDirty[i] = true; } else { newChildDirty[i] = false || oldChildDirty[i]; } } } childDirty = newChildDirty; } } ArrayProperty(Property parent, Field field, int flags); }
ArrayProperty extends ScalarProperty { @Override public void setValue(Object value) throws PropertyException { if (value == null) { childDirty = new boolean[0]; super.setValue(null); } else { Object[] oldValues = (Object[]) internalGetValue(); boolean[] oldChildDirty = getChildDirty(); super.setValue(value); Object[] newValues = (Object[]) internalGetValue(); boolean[] newChildDirty = new boolean[newValues != null ? newValues.length : 0]; for (int i = 0; i < newChildDirty.length; i++) { Object newValue = newValues[i]; if (oldValues == null || i >= oldValues.length) { newChildDirty[i] = true; } else { Object oldValue = oldValues[i]; if (!((newValue == null && oldValue == null) || (newValue != null && newValue.equals(oldValue)))) { newChildDirty[i] = true; } else { newChildDirty[i] = false || oldChildDirty[i]; } } } childDirty = newChildDirty; } } ArrayProperty(Property parent, Field field, int flags); @Override ListType getType(); @Override boolean isContainer(); @Override void setValue(Object value); @Override boolean isNormalized(Object value); @Override Serializable normalize(Object value); @SuppressWarnings("unchecked") @Override T convertTo(Serializable value, Class<T> toType); @Override Object newInstance(); boolean isDirty(int index); @Override void clearDirtyFlags(); }
ArrayProperty extends ScalarProperty { @Override public void setValue(Object value) throws PropertyException { if (value == null) { childDirty = new boolean[0]; super.setValue(null); } else { Object[] oldValues = (Object[]) internalGetValue(); boolean[] oldChildDirty = getChildDirty(); super.setValue(value); Object[] newValues = (Object[]) internalGetValue(); boolean[] newChildDirty = new boolean[newValues != null ? newValues.length : 0]; for (int i = 0; i < newChildDirty.length; i++) { Object newValue = newValues[i]; if (oldValues == null || i >= oldValues.length) { newChildDirty[i] = true; } else { Object oldValue = oldValues[i]; if (!((newValue == null && oldValue == null) || (newValue != null && newValue.equals(oldValue)))) { newChildDirty[i] = true; } else { newChildDirty[i] = false || oldChildDirty[i]; } } } childDirty = newChildDirty; } } ArrayProperty(Property parent, Field field, int flags); @Override ListType getType(); @Override boolean isContainer(); @Override void setValue(Object value); @Override boolean isNormalized(Object value); @Override Serializable normalize(Object value); @SuppressWarnings("unchecked") @Override T convertTo(Serializable value, Class<T> toType); @Override Object newInstance(); boolean isDirty(int index); @Override void clearDirtyFlags();  }