public class Selma extends Object
// Without sources
Selma.builder(MapperInterface.class).build();
// With sources
Selma.builder(MapperInterface.class).withSources(sourceInstance).build();
// Without customMapper
Selma.builder(MapperInterface.class).withCustomMappers(customMappers).build();
// With sources
Selma.builder(MapperInterface.class).withCustomMappers(customMappers).build();
It also offers two simple static methods getMapper(MapperInterface.class) offering the same service level.
Please notice that Selma holds a cache of the instantiated Mappers, and will maintain them as Singleton.
You can bypass the cache using the builder API and specifying disableCache() on it.
| Modifier and Type | Class and Description |
|---|---|
static class |
Selma.MapperBuilder<T> |
| Modifier and Type | Field and Description |
|---|---|
static String |
SET_CUSTOM_MAPPER |
static String |
SET_FACTORY |
| Constructor and Description |
|---|
Selma() |
| Modifier and Type | Method and Description |
|---|---|
static <T> Selma.MapperBuilder<T> |
builder(Class<T> mapperClass)
Return a builder style component to build the Mapper using this builder you can pass the sources, custom mappers and bypass the default cache registry.
|
static <T> T |
getMapper(Class<T> mapperClass)
Mapper Builder DSL for those who like it like that.
|
static <T> T |
getMapper(Class<T> mapperClass,
Object source,
Object customMapper)
Retrieve the generated Mapper for the corresponding interface in the classpath.
|
static <T> T |
getMapperWithCustom(Class<T> mapperClass,
Object custom)
Retrieve or build the mapper generated for the given interface
|
static <T> T |
mapper(Class<T> mapperClass)
Retrieve the generated Mapper for the corresponding interface in the classpath and instantiate it.
|
static <T> T |
mapper(Class<T> mapperClass,
Object source)
Mapper Builder DSL for those who like it like that.
|
public static final String SET_CUSTOM_MAPPER
public static final String SET_FACTORY
public static <T> Selma.MapperBuilder<T> builder(Class<T> mapperClass)
mapperClass - The Mapper interface classIllegalArgumentException - If for some reason the Mapper class can not be loaded or instantiatedpublic static <T> T mapper(Class<T> mapperClass) throws IllegalArgumentException
T - The Mapper interface itselfmapperClass - The Mapper interface classIllegalArgumentException - If for some reason the Mapper class can not be loaded or instantiatedpublic static <T> T mapper(Class<T> mapperClass, Object source)
T - The Mapper interface itselfmapperClass - The Mapper interface classpublic static <T> T getMapper(Class<T> mapperClass)
T - The Mapper interface itselfmapperClass - The Mapper interface classpublic static <T> T getMapperWithCustom(Class<T> mapperClass, Object custom)
T - The Mapper interface itselfmapperClass - The Mapper interface classpublic static <T> T getMapper(Class<T> mapperClass, Object source, Object customMapper) throws IllegalArgumentException
T - The Mapper interface itselfmapperClass - The Mapper interface classsource - The Source to be passed to bean constructor or null for defaultIllegalArgumentException - If for some reason the Mapper class can not be loaded or instantiatedCopyright © 2016. All Rights Reserved.