protected C getDelegate(boolean write) { if (write) { state.assertCanMutate(); } Collection<T> delegate = Cast.uncheckedCast(ScalarCollectionSchema.get(modelNode)); return initialValue(write, delegate); }
@Override public Optional<String> getValueDescription(MutableModelNode modelNodeInternal) { Collection<?> values = ScalarCollectionSchema.get(modelNodeInternal); if (values == null) { return Optional.absent(); } return Optional.of(values.toString()); }
private C initialValue(boolean write, Collection<T> delegate) { if (delegate == null) { if (write) { delegate = createPrivateData(true); ScalarCollectionSchema.set(modelNode, delegate); } else { delegate = createPrivateData(false); } } return Cast.uncheckedCast(delegate); }