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

ca.gc.aafc.dina.config.ResourceNameIdentifierConfig Maven / Gradle / Ivy

There is a newer version: 0.132
Show newest version
package ca.gc.aafc.dina.config;

import java.util.Map;
import java.util.Optional;
import lombok.Builder;
import lombok.Singular;

/**
 * This class allows to configure the fields name for classes that may be used for
 * ResourceNameIdentifier service.
 */
@Builder
public class ResourceNameIdentifierConfig {

  public static final ResourceNameConfig DEFAULT_CONFIG =
    new ResourceNameConfig("name", "group");

  @Singular
  private Map, ResourceNameConfig> configs;

  /**
   * Get the {@link ResourceNameConfig} for the provided class or {@link Optional#empty()}
   * @param clazz
   * @return @link ResourceNameConfig} for the provided class or {@link Optional#empty()}
   */
  public Optional getResourceNameConfig(Class clazz) {
    return Optional.ofNullable(configs.get(clazz));
  }

  public record ResourceNameConfig(String nameColumn, String groupColumn) {
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy