All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.mmm.property.builder.container.ListPropertyBuilder 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 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.validation.collection.ValidatorBuilderList;

/**
 * {@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#asList()
 */
public class ListPropertyBuilder extends
    PropertyBuilder, ListProperty, ValidatorBuilderList>, ListPropertyBuilder> {

  private Property valueProperty;

  /**
   * The constructor.
   *
   * @param lock the {@link #getLock() lock}.
   */
  public ListPropertyBuilder(AttributeReadOnly lock) {

    this(lock, null);
  }

  /**
   * The constructor.
   *
   * @param lock the {@link #getLock() lock}.
   * @param valueProperty the {@link ListProperty#getValueProperty() value property}.
   */
  public ListPropertyBuilder(AttributeReadOnly lock, Property valueProperty) {

    super(lock);
    this.valueProperty = valueProperty;
  }

  /**
   * @param property the {@link ListProperty#getValueProperty() value property}.
   * @return this builder itself ({@code this}) for fluent API calls.
   */
  public ListPropertyBuilder valueProperty(Property property) {

    this.valueProperty = property;
    return this;
  }

  @Override
  protected ValidatorBuilderList> createValidatorBuilder() {

    return new ValidatorBuilderList<>(this);
  }

  @Override
  protected ListProperty build(String name, PropertyMetadata> metadata) {

    return new ListProperty<>(name, this.valueProperty, metadata);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy