ObjectValue extends PropertyValue { @Override public ListValue toListValue(){ ListValue array = new ListValue(getKey()); array.setParent(getParent()); array.setMeta(getMeta()); array.setVersion(getVersion()); for(PropertyValue val:fields.values()){ array.addPropertyValue(val.deepClone()); } return array; } ObjectValue( String key); @Override ValueType getValueType(); Collection<PropertyValue> getValues(); Set<String> getKeys(); PropertyValue getPropertyValue(String name); String getValue(); @Override PropertyValue setValue(String value); String getValue(String key); T getOrSetValue(String name, Supplier<T> valueSupplier); @Override int getSize(); ObjectValue setValues(Map<String, String> config); ObjectValue setValues(Map<String, String> config, String source, boolean overwriteExisting); @Override ObjectValue toObjectValue(); @Override ListValue toListValue(); @Override Iterator<PropertyValue> iterator(); ObjectValue setValue(String k, String v); ListValue addList(String key); ObjectValue addObject(String key); PropertyValue setValueWithCompositeKey(String key, String value); Collection<PropertyValue> setValueWithCompositeKey(Map<String,String> values); @Override Map<String,String> toMap(); @Override Map<String,String> toLocalMap(); @Override ObjectValue mutable(); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); static ObjectValue from(Collection<PropertyValue> values);  }
@Test public void toListValue() { ObjectValue ov = PropertyValue.createObject("foo"); ov.addList("list").addValue("a"); ListValue lv = ov.toListValue(); assertThat(lv).isNotNull(); assertThat(lv.getKey()).isEqualTo(ov.getKey()); assertThat(lv.getPropertyValue(0)).isNotNull(); assertThat(ov.getValue("list")).isEqualTo(lv.getPropertyValue(0).getValue()); }