MCPcopy Index your code
hub / github.com/DozerMapper/dozer

github.com/DozerMapper/dozer @v7.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v7.0.0 ↗ · + Follow
5,805 symbols 16,383 edges 857 files 519 documented · 9%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Build, Test and Analyze Release Version License

Dozer

Project Activity

The project is currently not active and will more than likely be deprecated in the future. If you are looking to use Dozer on a greenfield project, we would discourage that. If you have been using Dozer for a while, we would suggest you start to think about migrating onto another library, such as: - mapstruct - modelmapper

For those moving to mapstruct, the community has created a Intellij plugin that can help with the migration.

Why Map?

A mapping framework is useful in a layered architecture where you are creating layers of abstraction by encapsulating changes to particular data objects vs. propagating these objects to other layers (i.e. external service data objects, domain objects, data transfer objects, internal service data objects).

Mapping between data objects has traditionally been addressed by hand coding value object assemblers (or converters) that copy data between the objects. Most programmers will develop some sort of custom mapping framework and spend countless hours and thousands of lines of code mapping to and from their different data object.

This type of code for such conversions is rather boring to write, so why not do it automatically?

What is Dozer?

Dozer is a Java Bean to Java Bean mapper that recursively copies data from one object to another, it is an open source mapping framework that is robust, generic, flexible, reusable, and configurable.

Dozer supports simple property mapping, complex type mapping, bi-directional mapping, implicit-explicit mapping, as well as recursive mapping. This includes mapping collection attributes that also need mapping at the element level.

Dozer not only supports mapping between attribute names, but also automatically converting between types. Most conversion scenarios are supported out of the box, but Dozer also allows you to specify custom conversions via XML or code-based configuration.

Getting Started

Check out the Getting Started Guide, Full User Guide or GitBook for advanced information.

Getting the Distribution

If you are using Maven, simply copy-paste this dependency to your project.

<dependency>
    <groupId>com.github.dozermapper</groupId>
    <artifactId>dozer-core</artifactId>
    <version>7.0.0</version>
</dependency>

Simple Example

<mapping>
  <class-a>yourpackage.SourceClassName</class-a>
  <class-b>yourpackage.DestinationClassName</class-b>
    <field>
      <a>yourSourceFieldName</a>
      <b>yourDestinationFieldName</b>
    </field>
</mapping>
SourceClassName sourceObject = new SourceClassName();
sourceObject.setYourSourceFieldName("Dozer");

Mapper mapper = DozerBeanMapperBuilder.buildDefault();
DestinationClassName destObject = mapper.map(sourceObject, DestinationClassName.class);

assertTrue(destObject.getYourDestinationFieldName().equals(sourceObject.getYourSourceFieldName()));

Extension points exported contracts — how you extend this code

MapperAware (Interface)
Interface that gives an ability to receive mapper instance inside com.github.dozermapper.core.CustomConverter. D [10 implementers]
core/src/main/java/com/github/dozermapper/core/MapperAware.java
DozerBeanMapperBuilderCustomizer (Interface)
The customizer interface for the DozerBeanMapperBuilder. @since 6.5.0 [2 implementers]
dozer-integrations/dozer-spring-support/dozer-spring4/src/main/java/com/github/dozermapper/spring/DozerBeanMapperBuilderCustomizer.java
CustomConverter (Interface)
Public custom converter interface. In the Dozer mapping file(s), you can add some XML to tell Dozer to use a custom [43 …
core/src/main/java/com/github/dozermapper/core/CustomConverter.java
BeanFactory (Interface)
Public custom bean factory interface. You can configure Dozer to use custom bean factories to create new instances o [16 …
core/src/main/java/com/github/dozermapper/core/BeanFactory.java
DozerPropertyDescriptor (Interface)
Internal property descriptor interface. Only intended for internal use. Dozer property descriptors are used to read and [10 …
core/src/main/java/com/github/dozermapper/core/propertydescriptor/DozerPropertyDescriptor.java
BeanMappingsBuilder (Interface)
Builds a mapping definition [33 implementers]
core/src/main/java/com/github/dozermapper/core/builder/BeanMappingsBuilder.java

Core symbols most depended-on inside this repo

map
called by 607
core/src/main/java/com/github/dozermapper/core/Mapper.java
newInstance
called by 429
core/src/test/java/com/github/dozermapper/core/functional_tests/DataObjectInstantiator.java
get
called by 256
core/src/main/java/com/github/dozermapper/core/cache/Cache.java
put
called by 178
core/src/main/java/com/github/dozermapper/core/cache/Cache.java
convert
called by 164
core/src/main/java/com/github/dozermapper/core/CustomConverter.java
size
called by 138
core/src/main/java/com/github/dozermapper/core/classmap/ClassMappings.java
valueOf
called by 131
core/src/main/java/com/github/dozermapper/core/classmap/MappingDirection.java
equals
called by 119
core/src/main/java/com/github/dozermapper/core/cache/CacheEntry.java

Shape

Method 4,788
Class 924
Interface 78
Enum 15

Languages

Java100%

Modules by API surface

core/src/test/java/com/github/dozermapper/core/vo/TestObject.java96 symbols
core/src/main/java/com/github/dozermapper/core/loader/DozerBuilder.java95 symbols
core/src/test/java/com/github/dozermapper/core/vo/TestObjectPrime.java85 symbols
core/src/main/java/com/github/dozermapper/core/fieldmap/FieldMap.java77 symbols
core/src/main/java/com/github/dozermapper/core/classmap/ClassMap.java62 symbols
core/src/main/java/com/github/dozermapper/core/builder/model/jaxb/MappingDefinition.java54 symbols
core/src/main/java/com/github/dozermapper/core/builder/model/jaxb/FieldDefinition.java50 symbols
core/src/test/java/com/github/dozermapper/core/util/ReflectionUtilsTest.java49 symbols
core/src/main/java/com/github/dozermapper/core/factory/ConstructionStrategies.java46 symbols
core/src/test/java/com/github/dozermapper/core/functional_tests/GranularDozerBeanMapperTest.java44 symbols
core/src/main/java/com/github/dozermapper/core/builder/model/jaxb/ConfigurationDefinition.java44 symbols
core/src/main/java/com/github/dozermapper/core/builder/model/jaxb/FieldDefinitionDefinition.java41 symbols

For agents

$ claude mcp add dozer \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact