/** * Create a new {@link BooleanProperty} cloned from the given property, setting this {@link DataTarget} as property * parent path. * @param fromProperty The property to clone (not null) * @return The cloned property */ default BooleanProperty property(BooleanProperty fromProperty) { ObjectUtils.argumentNotNull(fromProperty, "Property must be not null"); return fromProperty.clone(builder -> builder.parent(this)); }
/** * Create a new {@link BooleanProperty} 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 BooleanProperty} builder */ static BooleanPropertyBuilder create(Path<Boolean> path) { ObjectUtils.argumentNotNull(path, "Path must be not null"); BooleanPropertyBuilder builder = create(path.getName()); path.getParent().ifPresent(p -> builder.parent(p)); return builder; }
/** * Create a new {@link BooleanProperty} with given <code>name</code>, using a default {@link PropertyValueConverter} * to convert a numeric model data type into the boolean type. * @param <N> Numeric model data type * @param name Property name (not null) * @param modelType Numeric model data type (not null) * @return {@link BooleanProperty} builder * @see PropertyValueConverter#numericBoolean(Class) */ static <N extends Number> BooleanPropertyBuilder create(String name, Class<N> modelType) { ObjectUtils.argumentNotNull(modelType, "Model type must be not null"); return create(name).converter(PropertyValueConverter.numericBoolean(modelType)); }
public void input7() { // tag::input7[] BooleanProperty PROPERTY = BooleanProperty.create("test"); Input<Integer> integerInput = Input.number(Integer.class).build(); // <1> Input<Boolean> booleanInput = Input.from(integerInput, PROPERTY, PropertyValueConverter.numericBoolean(Integer.class)); // <2> // end::input7[] }
public void propertyListing2() { // tag::propertyListing2[] final NumericProperty<Long> ID = NumericProperty.longType("id"); final StringProperty DESCRIPTION = StringProperty.create("description"); final BooleanProperty ACTIVE = BooleanProperty.create("active"); final PropertySet<?> PROPERTIES = PropertySet.of(ID, DESCRIPTION, ACTIVE); PropertyListing listing = Components.listing.properties(PROPERTIES) // <1> .build(DESCRIPTION, ID); // <2> // end::propertyListing2[] }
public void propertyListing3() { // tag::propertyListing3[] final NumericProperty<Long> ID = NumericProperty.longType("id"); final StringProperty DESCRIPTION = StringProperty.create("description"); final BooleanProperty ACTIVE = BooleanProperty.create("active"); final PropertySet<?> PROPERTIES = PropertySet.of(ID, DESCRIPTION, ACTIVE); PropertyListing listing = Components.listing.properties(PROPERTIES) // .displayAsFirst(ACTIVE) // <1> .displayBefore(ID, DESCRIPTION) // <2> .displayAfter(DESCRIPTION, ACTIVE) // <3> .build(); // end::propertyListing3[] }