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

io.github.mmm.entity.property.id.FkPropertyBuilder 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.entity.property.id;

import io.github.mmm.entity.bean.EntityBean;
import io.github.mmm.entity.id.Id;
import io.github.mmm.property.AttributeReadOnly;
import io.github.mmm.property.PropertyMetadata;
import io.github.mmm.property.builder.PropertyBuilder;
import io.github.mmm.validation.main.ValidatorBuilderObject;

/**
 * {@link PropertyBuilder} for {@link IdProperty}.
 *
 * @param  type of the referenced {@link EntityBean}.
 * @since 1.0.0
 */
public final class FkPropertyBuilder extends
    PropertyBuilder, FkProperty, ValidatorBuilderObject, FkPropertyBuilder>, FkPropertyBuilder> {

  private Id id;

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

    super(lock);
  }

  /**
   * The constructor.
   *
   * @param lock the {@link #getLock() lock}.
   * @param idTemplate the {@link Class} reflecting the entity.
   */
  public FkPropertyBuilder(AttributeReadOnly lock, Id idTemplate) {

    super(lock);
    this.id = idTemplate;
  }

  @Override
  protected ValidatorBuilderObject, FkPropertyBuilder> createValidatorBuilder() {

    return new ValidatorBuilderObject<>(this);
  }

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

    return new FkProperty<>(name, this.id, metadata);
  }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy