/** * Add a {@link PropertySet} configuration parameter * @param name The parameter name to add (not null) * @param value The configuration parameter value * @return this * @deprecated Use {@link #withConfiguration(String, Object)} */ @Deprecated default Builder<P> configuration(String name, Object value) { return withConfiguration(name, value); }
/** * Add a {@link PropertySet} configuration parameter using a {@link ConfigProperty}, with * {@link ConfigProperty#getKey()} as parameter name. * @param <C> Config property type * @param configurationProperty The {@link ConfigProperty} to add (not null) * @param value The configuration property value * @return this * @deprecated Use {@link #withConfiguration(ConfigProperty, Object)} */ @Deprecated default <C> Builder<P> configuration(ConfigProperty<C> configurationProperty, C value) { ObjectUtils.argumentNotNull(configurationProperty, "Configuration property must be not null"); return withConfiguration(configurationProperty.getKey(), value); }
public void serializationConfig() { // tag::sconfig[] StringProperty NAME = StringProperty.create("name"); // <1> VirtualProperty<String> VRT = VirtualProperty.create(String.class, pb -> "(" + pb.getValue(NAME) + ")") .name("vrt"); // <2> final PropertySet<?> PROPERTY_SET = PropertySet.builderOf(NAME, VRT).withConfiguration( JsonConfigProperties.PROPERTYBOX_SERIALIZATION_MODE, PropertyBoxSerializationMode.ALL).build(); // <3> PropertyBox propertyBox = PropertyBox.builder(PROPERTY_SET).set(NAME, "test").build(); // <4> // end::sconfig[] }
/** * Add a {@link PropertySet} configuration parameter using a {@link ConfigProperty}, with * {@link ConfigProperty#getKey()} as parameter name. * @param <C> Config property type * @param configurationProperty The {@link ConfigProperty} to add (not null) * @param value The configuration property value * @return this */ default <C> Builder<P> withConfiguration(ConfigProperty<C> configurationProperty, C value) { ObjectUtils.argumentNotNull(configurationProperty, "Configuration property must be not null"); return withConfiguration(configurationProperty.getKey(), value); }
public void dataMappable2() { final StringProperty P1 = StringProperty.create("p1"); final StringProperty P2 = StringProperty.create("p2"); // tag::datamappable2[] PropertySet<?> PROPERTIES = PropertySet.builderOf(P1, P2) // .withConfiguration(DataMappable.PATH, "mapping-name") // <1> .build(); Optional<String> mapping = PROPERTIES.getConfiguration().getParameter(DataMappable.PATH); // <2> // end::datamappable2[] }