001package net.tnemc.item.platform.registry;
002/*
003 * The New Item Library
004 * Copyright (C) 2022 - 2025 Daniel "creatorfromhell" Vidmar
005 *
006 * This program is free software; you can redistribute it and/or
007 * modify it under the terms of the GNU Lesser General Public
008 * License as published by the Free Software Foundation; either
009 * version 3 of the License, or (at your option) any later version.
010 *
011 * This program is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 * Lesser General Public License for more details.
015 *
016 * You should have received a copy of the GNU Lesser General Public License
017 * along with this program; if not, write to the Free Software Foundation,
018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
019 */
020
021import org.jetbrains.annotations.NotNull;
022
023import java.util.LinkedList;
024import java.util.function.Supplier;
025
026/**
027 * SupplierRegistryHandler extends RegistryHandler and handles the initialization of keys using a Supplier.
028 *
029 * @author creatorfromhell
030 * @since 0.2.0.0
031 */
032public class SupplierRegistryHandler extends RegistryHandler {
033
034  protected final Supplier<LinkedList<String>> keysSupplier;
035
036  public SupplierRegistryHandler(final @NotNull Supplier<LinkedList<String>> keysSupplier) {
037
038    this.keysSupplier = keysSupplier;
039  }
040
041  @Override
042  public void initialize() {
043
044    keys.addAll(keysSupplier.get());
045  }
046}