Interface ExtensibleEnumProvider<T extends ExtensibleEnum>

Type Parameters:
T - The type of extensible enum to extend
All Superinterfaces:
SpiService
All Known Subinterfaces:
LanguageProvider, LifecycleProvider, PackagingProvider, PathScopeProvider, ProjectScopeProvider, TypeProvider
All Known Implementing Classes:
DefaultLifecycleRegistry.LifecycleWrapperProvider, DefaultTypeProvider, DefaultTypeProvider

@Experimental @Consumer public interface ExtensibleEnumProvider<T extends ExtensibleEnum> extends SpiService
An SPI interface to extend Maven with new enum values for extensible enumerations.

Maven uses extensible enumerations to allow plugins and extensions to add new values to various categories like languages, scopes, and packaging types. This interface is the base for all providers that register such extensions.

Implementations of this interface are discovered through the Java ServiceLoader mechanism. Each implementation must be registered in a META-INF/services/ file corresponding to the specific provider interface being implemented.

Example implementation for a custom language provider:

 public class CustomLanguageProvider implements LanguageProvider {
     public Collection<Language> provides() {
         return Arrays.asList(
             language("kotlin"),
             language("scala")
         );
     }
 }
 
Since:
4.0.0
  • Method Summary

    Modifier and Type
    Method
    Description
    Provides new values for the extensible enum.
  • Method Details

    • provides

      @Nonnull Collection<T> provides()
      Provides new values for the extensible enum.

      This method is called by Maven during initialization to collect all custom enum values that should be registered. The returned collection should contain all the enum values that this provider wants to contribute.

      The values returned by this method should be created using the appropriate factory methods for the specific enum type, such as language(), projectScope(), or pathScope().

      Returns:
      a non-null collection of enum instances to register