Package org.instancio.spi
Interface GeneratorProvider
Deprecated.
A Service Provider Interface for mapping classes to custom
Generator
implementations.
Implementations of this class can be registered by placing a file named
org.instancio.spi.GeneratorProvider
under /META-INF/services
.
The file must contain the fully-qualified name of the implementing class.
For example, the following sample implementation:
package com.example;
// imports omitted
public class SampleGeneratorProvider implements GeneratorProvider {
@Override
public Map<Class<?>, Generator<?>> getGenerators() {
Map<Class<?>, Generator<?>> map = new HashMap<>();
map.put(Book.class, new BookGenerator());
map.put(Author.class, new AuthorGenerator());
return map;
}
}
can be registered by creating a file
/META-INF/services/org.instancio.spi.GeneratorProvider
containing the following line:
com.example.SampleGeneratorProvider
- Since:
- 1.2.0
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiongetGenerators
(GeneratorContext context) Deprecated.this method will be removed in version3.0.0
; useInstancioServiceProvider.getGeneratorProvider()
instead.
-
Method Details
-
getGenerators
Deprecated.this method will be removed in version3.0.0
; useInstancioServiceProvider.getGeneratorProvider()
instead.Provides a map of generators to register.- Parameters:
context
- generator context- Returns:
- class to generator mapping
- Since:
- 1.2.0
-
InstancioServiceProvider
instead. This class will be removed in version3.0.0
.