Interface InstancioServiceProvider.GeneratorProvider

Enclosing interface:
InstancioServiceProvider

public static interface InstancioServiceProvider.GeneratorProvider
Provides custom Generator classes.

An implementation of this interface can be returned via the InstancioServiceProvider.getGeneratorProvider() method.

Since:
2.11.0
  • Method Summary

    Modifier and Type
    Method
    Description
    getGenerator(Node node, Generators generators)
    Returns a generator spec for the specified node.
  • Method Details

    • getGenerator

      GeneratorSpec<?> getGenerator(Node node, Generators generators)
      Returns a generator spec for the specified node. The returned spec must also implement the Generator interface.

      If the implementation does not define a generator for the given node, then a null can be returned.

      Parameters:
      node - for which to return a generator
      generators - provides access to built-in generators
      Returns:
      generator spec for the given node, or null
      Throws:
      InstancioSpiException - if the returned generator spec does not implement Generator
      Since:
      2.11.0