001/*
002 * JDrupes Builder
003 * Copyright (C) 2025 Michael N. Lipp
004 * 
005 * This program is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU Affero General Public License as
007 * published by the Free Software Foundation, either version 3 of the
008 * License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013 * GNU Affero General Public License for more details.
014 *
015 * You should have received a copy of the GNU Affero General Public License
016 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
017 */
018
019package org.jdrupes.builder.api;
020
021/// Models a [ResourceProvider] that generates new [Resource]s (artifacts)
022/// and makes them available to a [Project].
023///
024/// In general, generators follow one of the following patterns:
025///
026///  1. They generate resources from arbitrary inputs. In this case,
027///     methods for adding inputs should be named as appropriate for
028///     the generator and the type of input.
029///
030///  2. They generate resources from explicitly specified resources.
031///     In this case, methods for adding inputs should be named
032///     `add(Type... values)` for enumerated values and
033///     `addXxx(Stream<Type> values)` for streams. (We cannot defines
034///     a generic `add(Stream<T>)` method due to type erasure.)
035///
036///  3. They generate resources from resources actively obtained from
037///     [ResourceProvider]s. In this case, methods for adding providers
038///     should be named `from(...)`. This can be enforced by implementing
039///     [ResourceRetriever].
040///
041/// All generators must handle requests for [Cleanliness].
042///
043public interface Generator extends ResourceProvider {
044
045    /// Returns the generator's name.
046    ///
047    /// @return the string
048    ///
049    String name();
050
051    /// Returns the project that this generator belongs to.
052    ///
053    /// @return the project
054    ///
055    Project project();
056
057}