public class Mappers extends Object
Mapper.componentModel()
.
Mapper implementation types are expected to have the same fully qualified name as their interface type, with the
suffix Impl
appended. When using this factory, mapper types - and any mappers they use - are instantiated by
invoking their public no-args constructor.
By convention, a single instance of each mapper is retrieved from the factory and exposed on the mapper interface
type by declaring a member named INSTANCE
like this:
@Mapper public interface CustomerMapper { CustomerMapper INSTANCE = Mappers.getMapper( CustomerMapper.class ); // mapping methods... }
Modifier and Type | Method and Description |
---|---|
static <T> T |
getMapper(Class<T> clazz)
Returns an instance of the given mapper type.
|
static <T> Class<? extends T> |
getMapperClass(Class<T> clazz)
Returns the class of the implementation for the given mapper type.
|
public static <T> T getMapper(Class<T> clazz)
T
- The type of the mapper to create.clazz
- The type of the mapper to return.public static <T> Class<? extends T> getMapperClass(Class<T> clazz)
T
- The type of the mapper to create.clazz
- The type of the mapper to return.Copyright © 2012-2021 MapStruct Authors; All rights reserved. Released under the Apache Software License 2.0.