Package overit.geocall.model
Class M2Mapper
java.lang.Object
org.modelmapper.ModelMapper
overit.geocall.model.M2Mapper
M2Mapper extends ModelMapper that have an intelligent object mapping. M2Mapper is a class
you instantiate to perform object mapping, load mapping definitions and register mappers.
-
Constructor Summary
ConstructorsConstructorDescriptionM2Mapper()Main constructor for M2MapperM2Mapper(Configuration.AccessLevel accessLevel) Constructor for M2Mapper with specified access level configuration. -
Method Summary
Modifier and TypeMethodDescription<D> D<D> Dvoidvoid<D> D<D> Dprotected voidvalidateObject(Object obj) withFieldsCondition(Collection<String> fields) Gets a Mapper with the filter conditions defined by the Collection fields.withFieldsCondition(Collection<String> fields, Configuration.AccessLevel accessLevel) Creates a new M2Mapper instance with field filtering conditions and specified access level.Methods inherited from class org.modelmapper.ModelMapper
addConverter, addConverter, addMappings, createTypeMap, createTypeMap, createTypeMap, createTypeMap, createTypeMap, createTypeMap, createTypeMap, createTypeMap, emptyTypeMap, emptyTypeMap, getConfiguration, getTypeMap, getTypeMap, getTypeMaps, registerModule, typeMap, typeMap, validate
-
Constructor Details
-
M2Mapper
public M2Mapper()Main constructor for M2Mapper -
M2Mapper
Constructor for M2Mapper with specified access level configuration. Creates a new M2Mapper instance with the given access level for field mapping, using default providers for factory, date time ranges, and validation.- Parameters:
accessLevel- The access level to use for field mapping (PUBLIC, PRIVATE, PROTECTED, PACKAGE_PRIVATE)
-
-
Method Details
-
map
- Overrides:
mapin classModelMapper
-
map
- Overrides:
mapin classModelMapper
-
map
- Overrides:
mapin classModelMapper
-
map
- Overrides:
mapin classModelMapper
-
map
- Overrides:
mapin classModelMapper
-
map
- Overrides:
mapin classModelMapper
-
validateObject
-
withFieldsCondition
Gets a Mapper with the filter conditions defined by the Collection fields.- Parameters:
fields- The Collection of fields form which define the filter conditions for the mapper- Returns:
- Mapper with the filter conditions defined by the Collection fields.
-
withFieldsCondition
public M2Mapper withFieldsCondition(Collection<String> fields, Configuration.AccessLevel accessLevel) Creates a new M2Mapper instance with field filtering conditions and specified access level. This method returns a copy of the current mapper configured to only map fields that are included in the provided collection. If the fields collection is null or empty, returns the current mapper instance unchanged.The returned mapper will: - Only map properties whose names or JSON aliases are contained in the fields collection - Use the specified access level for field mapping - Include properties annotated with @JsonInclude regardless of the fields filter
- Parameters:
fields- The collection of field names to include in the mapping. Field names can be property names or JSON property aliases (@JsonProperty, @JsonAlias)accessLevel- The access level to use for field mapping (PUBLIC, PRIVATE, PROTECTED, PACKAGE_PRIVATE)- Returns:
- A new M2Mapper instance with field filtering applied, or the current instance if fields is null or empty
-