All Projects → akkinoc → orika-spring-boot-starter

akkinoc / orika-spring-boot-starter

Licence: Apache-2.0 License
Spring Boot Starter for Orika.

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to orika-spring-boot-starter

Agilemapper
A zero-configuration, highly-configurable, unopinionated object mapper with viewable execution plans. Flattens, unflattens, deep clones, merges, updates and projects queries. Targets .NET 3.5+ and .NET Standard 1.0+
Stars: ✭ 345 (+197.41%)
Mutual labels:  mapping, mapper
Object Mapper
ObjectMapper is a class for automatic object mapping in Python
Stars: ✭ 72 (-37.93%)
Mutual labels:  mapping, mapper
Poiji
🍬 A tiny library converting excel rows to a list of Java objects based on Apache POI
Stars: ✭ 255 (+119.83%)
Mutual labels:  mapping, mapper
Spring Backend Boilerplate
The modularized backend boilerplate based on Spring Boot Framework, easy to get started and add your business part.
Stars: ✭ 134 (+15.52%)
Mutual labels:  spring-boot-starter, spring-framework
Batmap
🦇 Convention-based, fast object mapper.
Stars: ✭ 210 (+81.03%)
Mutual labels:  mapping, mapper
Mapster
A fast, fun and stimulating object to object Mapper
Stars: ✭ 1,375 (+1085.34%)
Mutual labels:  mapping, mapper
Mappinggenerator
🔄 "AutoMapper" like, Roslyn based, code fix provider that allows to generate mapping code in design time.
Stars: ✭ 831 (+616.38%)
Mutual labels:  mapping, mapper
JSONUtilities
Easily load JSON objects and decode them into structs or classes
Stars: ✭ 57 (-50.86%)
Mutual labels:  mapping, mapper
Jmapper Core
Elegance, high performance and robustness all in one java bean mapper
Stars: ✭ 159 (+37.07%)
Mutual labels:  mapping, mapper
Bull
BULL - Bean Utils Light Library
Stars: ✭ 150 (+29.31%)
Mutual labels:  mapping, mapper
logback-access-spring-boot-starter
Spring Boot Starter for Logback-access.
Stars: ✭ 153 (+31.9%)
Mutual labels:  spring-boot-starter, spring-framework
awesome-maps-ukraine
A curated list of maps of Ukraine, ukrainian mappers and tools that they use or develop for creating and publish maps
Stars: ✭ 35 (-69.83%)
Mutual labels:  mapping, mapper
metro-map-maker
Build the Metro system of your dreams: create your own metro maps, save them, and share with friends!
Stars: ✭ 41 (-64.66%)
Mutual labels:  mapping
gobatis
golang mybatis, 简单便捷
Stars: ✭ 46 (-60.34%)
Mutual labels:  mapper
spring-boot-starter-lock
spring 分布式锁
Stars: ✭ 12 (-89.66%)
Mutual labels:  spring-boot-starter
Slam-Dunk-Android
Android implementation of "Fusion of inertial and visual measurements for rgb-d slam on mobile devices"
Stars: ✭ 25 (-78.45%)
Mutual labels:  mapping
mybatis-mapper2sql
Generate SQL Statements from the MyBatis3 Mapper XML file
Stars: ✭ 61 (-47.41%)
Mutual labels:  mapper
turkeyvisited
Mark the cities you have visited in Turkey and share the map!
Stars: ✭ 82 (-29.31%)
Mutual labels:  mapping
TODO-List-Tech-Module
TODO List (in C#, Java, JS and PHP) - Exam Preparation for the Tech Module @ SoftUni (August 2017)
Stars: ✭ 13 (-88.79%)
Mutual labels:  spring-framework
usmap
🗺 Create US maps including Alaska and Hawaii in R
Stars: ✭ 52 (-55.17%)
Mutual labels:  mapping

orika-spring-boot-starter

maven central badge javadoc badge release badge build badge codecov badge license badge sponsor badge

Spring Boot Starter for Orika.

Features

  • Manages MapperFacade in the application context and makes it injectable into your code.
  • Provides an interface to configure MapperFactory.
  • Provides an interface to configure MapperFactoryBuilder.
  • Provides configuration properties to configure MapperFactoryBuilder.

Dependencies

Depends on:

  • Java 8, 11 or 17
  • Kotlin 1.6
  • Spring Boot 2.6
  • Orika 1.5

To run on Java 17+:

The following JVM option is required (orika-mapper/orika#377).

--add-opens java.base/java.lang=ALL-UNNAMED

Usage

Adding the Dependency

The artifact is published on Maven Central Repository. If you are using Maven, add the following dependency.

<dependency>
    <groupId>dev.akkinoc.spring.boot</groupId>
    <artifactId>orika-spring-boot-starter</artifactId>
    <version>${orika-spring-boot-starter.version}</version>
</dependency>

Injecting the MapperFacade

The MapperFacade is managed in the application context. Inject the MapperFacade into your code.

For example in Java:

import ma.glasnost.orika.MapperFacade;
@Autowired
private MapperFacade orikaMapperFacade;

Mapping Your Beans

Map your beans using the MapperFacade.

For example in Java:

// Maps from PersonSource to PersonDestination
PersonSource src = new PersonSource("John", "Smith", 23);
System.out.println(src);   // => "PersonSource(firstName=John, lastName=Smith, age=23)"
PersonDestination dest = orikaMapperFacade.map(src, PersonDestination.class);
System.out.println(dest);  // => "PersonDestination(givenName=John, sirName=Smith, age=23)"

MapperFactory Configuration

If you need to configure the MapperFactory, create an instance of OrikaMapperFactoryConfigurer in the application context. The OrikaMapperFactoryConfigurer components are auto-detected and the "configure" method is called.

For example in Java:

import dev.akkinoc.spring.boot.orika.OrikaMapperFactoryConfigurer;
import ma.glasnost.orika.MapperFactory;

@Component
public class PersonMapping implements OrikaMapperFactoryConfigurer {
    @Override
    public void configure(MapperFactory orikaMapperFactory) {
        orikaMapperFactory.classMap(PersonSource.class, PersonDestination.class)
                .field("firstName", "givenName")
                .field("lastName", "sirName")
                .byDefault()
                .register();
    }
}

See also the Orika User Guide:

MapperFactoryBuilder Configuration

If you need to configure the MapperFactoryBuilder, create an instance of OrikaMapperFactoryBuilderConfigurer in the application context. The OrikaMapperFactoryBuilderConfigurer components are auto-detected and the "configure" method is called.

For example in Java:

import dev.akkinoc.spring.boot.orika.OrikaMapperFactoryBuilderConfigurer;
import ma.glasnost.orika.impl.DefaultMapperFactory.MapperFactoryBuilder;

@Component
public class OrikaConfiguration implements OrikaMapperFactoryBuilderConfigurer {
    @Override
    public void configure(MapperFactoryBuilder<?, ?> orikaMapperFactoryBuilder) {
        // Your configuration codes.
    }
}

See also the Orika User Guide:

Configuration Properties

Provides the following configuration properties. These can be configured by your "application.yml", "application.properties", etc.

# The configuration properties for Orika.
orika:
  # Whether to enable auto-configuration.
  # Defaults to true.
  enabled: true
  # Whether to use built-in converters.
  # See also MapperFactoryBuilder.useBuiltinConverters.
  # By default, follows Orika's behavior.
  use-builtin-converters: true
  # Whether to use auto-mapping.
  # See also MapperFactoryBuilder.useAutoMapping.
  # By default, follows Orika's behavior.
  use-auto-mapping: true
  # Whether to map nulls.
  # See also MapperFactoryBuilder.mapNulls.
  # By default, follows Orika's behavior.
  map-nulls: true
  # Whether to dump the current state of the mapping infrastructure objects
  # upon occurrence of an exception while mapping.
  # See also MapperFactoryBuilder.dumpStateOnException.
  # By default, follows Orika's behavior.
  dump-state-on-exception: false
  # Whether to favor extension by default in registered class-maps.
  # See also MapperFactoryBuilder.favorExtension.
  # By default, follows Orika's behavior.
  favor-extension: false
  # Whether full field context should be captured.
  # See also MapperFactoryBuilder.captureFieldContext.
  # By default, follows Orika's behavior.
  capture-field-context: false

API Reference

Please refer to the Javadoc.

Release Notes

Please refer to the Releases page.

License

Licensed under the Apache License, Version 2.0.

Support the Project

If this project is useful to you, I appreciate giving a star to this repository
I would also appreciate if you would consider sponsoring as well 💖
Your support is my biggest motive force. Thanks

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].