@Test public void testArrayOfStrings() { ArrayProperty property = getArrayProperty(StringType.INSTANCE); String[] testStrings = new String[] {"there", null, "once", "was a dog"}; property.setValue(testStrings); assertArrayEquals(testStrings, (String[]) 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();  }