/** * Create a new {@link StringProperty} from given <code>path</code>, using given {@link Path} <code>name</code>. * @param path Path from which to obtain the property path name (not null) * @return {@link StringProperty} builder */ static StringPropertyBuilder create(Path<String> path) { ObjectUtils.argumentNotNull(path, "Path must be not null"); StringPropertyBuilder builder = create(path.getName()); path.getParent().ifPresent(p -> builder.parent(p)); return builder; }
public void propertyBox2() { // tag::propertybox2[] final PathProperty<Long> ID = PathProperty.create("id", Long.class).withValidator(Validator.notNull()); // <1> final StringProperty NAME = StringProperty.create("name").withValidator(Validator.notBlank()); // <2> final PropertySet<?> PROPERTIES = PropertySet.of(ID, NAME); PropertyBox propertyBox = PropertyBox.create(PROPERTIES); propertyBox.setValue(ID, null); // <3> propertyBox = PropertyBox.builder(PROPERTIES).invalidAllowed(true).build(); // <4> propertyBox.validate(); // <5> // end::propertybox2[] }
public void listing26() { // tag::listing26[] final StringProperty NAME = StringProperty.create("name").withValidator(Validator.notBlank()); // <1> PropertyListing.builder(SUBJECT) // .withValidator(NAME, Validator.max(10)) // <2> .build(); // end::listing26[] }
public void mapping() { // tag::mapping[] StringProperty PROPERTY = StringProperty.create("propertyName").dataPath("str"); // <1> // end::mapping[] }