/** * Clone this PropertyBox using given <code>propertySet</code>, i.e. create a new PropertyBox and copy all given set * property values from this box to the newly created box. * @param propertySet Property set of the cloned PropertyBox (not null) * @return A new, cloned, PropertyBox instance with given property set */ default PropertyBox cloneBox(Property<?>... propertySet) { ObjectUtils.argumentNotNull(propertySet, "Property set must be not null"); return cloneBox(PropertySet.of(propertySet)); }
public void propertyBox() { // tag::propertybox[] final PathProperty<Long> ID = PathProperty.create("id", Long.class); final StringProperty NAME = StringProperty.create("name"); final PropertySet<?> PROPERTIES = PropertySet.of(ID, NAME); PropertyBox propertyBox = PropertyBox.create(ID, NAME); // <1> propertyBox = PropertyBox.create(PROPERTIES); // <2> propertyBox.setValue(ID, 1L); // <3> propertyBox.setValue(NAME, "testName"); // <4> propertyBox = PropertyBox.builder(PROPERTIES).set(ID, 1L).set(NAME, "testName").build(); // <5> Long id = propertyBox.getValue(ID); // <6> String name = propertyBox.getValueIfPresent(NAME).orElse("default"); // <7> boolean containsNotNullId = propertyBox.containsValue(ID); // <8> PropertyBox ids = propertyBox.cloneBox(ID); // <9> // end::propertybox[] }