io.github.mmm.property.builder.container.SetPropertyBuilder Maven / Gradle / Ivy
/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0 */
package io.github.mmm.property.builder.container;
import java.util.List;
import java.util.Set;
import io.github.mmm.property.AttributeReadOnly;
import io.github.mmm.property.Property;
import io.github.mmm.property.PropertyMetadata;
import io.github.mmm.property.builder.PropertyBuilder;
import io.github.mmm.property.container.list.ListProperty;
import io.github.mmm.property.container.set.SetProperty;
import io.github.mmm.validation.collection.ValidatorBuilderSet;
/**
* {@link ProcessBuilder} for {@link ListProperty}.
*
* @param the generic type of the {@link List#contains(Object) elements contained} in the {@link List}.
* @since 1.0.0
* @see PropertyBuilder#asSet()
*/
public class SetPropertyBuilder extends
PropertyBuilder, SetProperty, ValidatorBuilderSet>, SetPropertyBuilder> {
private Property valueProperty;
/**
* The constructor.
*
* @param lock the {@link #getLock() lock}.
*/
public SetPropertyBuilder(AttributeReadOnly lock) {
this(lock, null);
}
/**
* The constructor.
*
* @param lock the {@link #getLock() lock}.
* @param componentProperty the {@link ListProperty#getValueProperty() value property}.
*/
public SetPropertyBuilder(AttributeReadOnly lock, Property componentProperty) {
super(lock);
this.valueProperty = componentProperty;
}
/**
* @param property the {@link ListProperty#getValueProperty() value property}.
* @return this builder itself ({@code this}) for fluent API calls.
*/
public SetPropertyBuilder componentProperty(Property property) {
this.valueProperty = property;
return this;
}
@Override
protected ValidatorBuilderSet> createValidatorBuilder() {
return new ValidatorBuilderSet<>(this);
}
@Override
protected SetProperty build(String name, PropertyMetadata> metadata) {
return new SetProperty<>(name, this.valueProperty, metadata);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy