Simpler, better and faster Java bean mapping framework

Overview

Build Status Join the chat at https://gitter.im/orika-mapper GitHub site Maven Central Javadocs License: Apache 2.0

Orika !

NEW We are pleased to announce the release of Orika 1.5.4 ! This version is available on Maven central repository

What?

Orika is a Java Bean mapping framework that recursively copies (among other capabilities) data from one object to another. It can be very useful when developing multi-layered applications.

Why?

Struggling with hand coded and reflection-based mappers? Orika can be used to simplify the process of mapping between one object layer and another.

Our ambition is to build a comprehensive, efficient and robust Java bean mapping solution. Orika focuses on automating as much as possible, while providing customization through configuration and extension where needed.

Orika enables the developer to :

  • Map complex and deeply structured objects
  • "Flatten" or "Expand" objects by mapping nested properties to top-level properties, and vice versa
  • Create mappers on-the-fly, and apply customizations to control some or all of the mapping
  • Create converters for complete control over the mapping of a specific set of objects anywhere in the object graph--by type, or even by specific property name
  • Handle proxies or enhanced objects (like those of Hibernate, or the various mock frameworks)
  • Apply bi-directional mapping with one configuration
  • Map to instances of an appropriate concrete class for a target abstract class or interface
  • Map POJO properties to Lists, Arrays, and Maps

How?

Orika uses byte code generation to create fast mappers with minimal overhead.

Want to give Orika a try? Check out our new User Guide

Acknowledgements

  • YourKit supports Orika with its full-featured Java Profiler. Take a look at YourKit's leading software products: YourKit Java Profiler.

  • JetBrains kindly provides Orika with a free open-source licence for their IntelliJ IDEA Ultimate edition.

Comments
  • Merge branch 1.5.x to master

    Merge branch 1.5.x to master

    There are multiple fixes in Branch 1.5 which I merged into the master (plus fixing optional dependency to guava):


    Compile Error with JDK5: ma.glasnost.orika.impl.generator.VariableRef line 56 contains the call Collections.newSetFromMap(..,) which only exists since 1.6: https://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#newSetFromMap%28java.util.Map%29

    I simply updated the maven-compiler-plugin in the pom.xml line 315&316 to 1.6 (because there is no open jdk-5 issue obviously no-one use orika with jdk5): https://github.com/brabenetz/orika/commit/c360935c779aba80cb9e02e0522eaa017eaf1a30


    Eclipse Settings folder ".settings" removed: most likely committed accidentally.


    Travis-CI: I'm not sure what the difference of the Travis-CI instances are, but I suppose that my instance is a newer container-based instance: My Travis-CI instance: https://travis-ci.org/brabenetz/orika/builds Orikas Travis-CI instance: https://travis-ci.org/orika-mapper/orika/builds

    The Results often differ in the results.

    At least for the container-based Travis-CI the following changes are required:

    • limit maven-surefire-plugin in memory: because the container based Travis-CI has only 3 GB ram which is less then the default VM. And some Memory-Consumption-Tests fills the memory with garbage to force the release of weak references.
    • set "sudo: false" in ".travis.yml" because container based Travice-CI doesn't allow sudo.

    I also added openjdk6 to the build.


    Fix Optional dependency to Guava: ma.glasnost.orika.metadata.Type and ma.glasnost.orika.impl.DefaultConcreteTypeMap uses the guva class ImmutableMap which make Guava not optional anymore. I refactored it with Collections.unmodifiableSet(...) and Collections.unmodifiableMap(...). The dependency commes in with the last merge of #157 and #155: https://github.com/orika-mapper/orika/pull/155 https://github.com/orika-mapper/orika/pull/157


    TypeFactory.refineBounds(...) line 388: The old code contained two iteratores of one collections which produced under wired circumstances concurrent mocification Exception. Tests for the new codes where added in TypeFactoryTestCase.


    Sub-Project "tests-jdk8": Special JDK8 Tests. e.g. with Interface default methods. This tests also failed because of the non-optional guava-dependency.

    opened by brabenetz 13
  • How to exclude a property of a nested multi-occurance element.

    How to exclude a property of a nested multi-occurance element.

    I have two classes: A and B. A has a property items which is a collection of B, when mapping I would like to exclude the id property of A and of all B items. How can I achieve it? The closest thing I found in the user guide is the names{fullName} example when working with nested multi-occurrence elements (nothing on exclusion though) - so I tried to do something similar to exclude the id of B but it results in the exclusion of the entire items property (needless to say that A's id gets excluded properly).

    @Entity
    public class A {
    
        @Id
        @GeneratedValue
        private Long id;
        //...
    
        @OneToMany()
        @JoinColumn(name = "a_id")
        private Set<B> items;
    
        // getters and setters
    }
    
    @Entity
    public class B {
    
        @Id
        @GeneratedValue
        private Long id;
        //...
    
        public B() {}
    
        // getters and setters
    }
    
    MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build();
            mapperFactory.classMap(A.class, A.class)
                    .mapNulls(true)
                    .exclude("id")
                    .exclude("items{id}")
                    .byDefault()
                    .register();
    
    MapperFacade mapperFacade = mapperFactory.getMapperFacade();
    A dest = mapperFacade.map(source, A.class);
    
    question 
    opened by medvednic 9
  • NullPointerException when MappingFactory.Factory is used to create MappingContext

    NullPointerException when MappingFactory.Factory is used to create MappingContext

    The following error occurred when MapperFacade.map(..) method was invoked with MappingContext object created by MappingContext.Factory().getContext() method:

    java.lang.NullPointerException at ma.glasnost.orika.impl.generator.MapperGenerator.build(MapperGenerator.java:104) at ma.glasnost.orika.impl.DefaultMapperFactory.buildMapper(DefaultMapperFactory.java:1333) at ma.glasnost.orika.impl.DefaultMapperFactory.lookupMapper(DefaultMapperFactory.java:718) at ma.glasnost.orika.impl.MapperFacadeImpl.resolveMapper(MapperFacadeImpl.java:572) at ma.glasnost.orika.impl.MapperFacadeImpl.resolveMappingStrategy(MapperFacadeImpl.java:179) at ma.glasnost.orika.impl.MapperFacadeImpl.map(MapperFacadeImpl.java:675)

    The problem is because MappingContext.Factory creates Context with empty globalProperties elements. When there is no CAPTURE_FIELD_CONTEXT property following line in SourceCodeContext.java class constructor causes NullPointerException:

    this.shouldCaptureFieldContext = (Boolean) mappingContext.getProperty(Properties.CAPTURE_FIELD_CONTEXT);

    The shouldCaptureFieldContext variable is a boolean type and cannot be set as a null.

    This issue occurred when orika-core was upgrade from 1.4.5 version to 1.5.0 version. Do You know some workaround for this problem? Can we expect fix for this issue in next release?

    Thanks & Regards, Piotr

    opened by miras108 9
  • Support for JSR-310 (Date and Time)

    Support for JSR-310 (Date and Time)

    Are there plans to support JSR-310 (java.time.LocalDate, java.time.LocalDateTime, java.time.LocalTime, etc)?

    Currently (version 1.5.0), needs to register converters. For example:

    mapperFactory.getConverterFactory()
            .registerConverter(new PassThroughConverter(LocalDate.class));
    

    I will be happy, if it conversion becomes built-in.

    Thanks.

    enhancement 
    opened by akkinoc 9
  • RamUsageEstimator fails with ClassNotFound

    RamUsageEstimator fails with ClassNotFound

    As the title already says the RamUsageEstimator fails with ClassNotFound when inspecting the objectFactoryRegistry (see Stacktrace below). This in turn hides the real Exception in the mapping. State reporting should not fail with exceptions caused by it or its underlying tools. I guess this has to do with something funny with the classloader.

    There is already a property for DUMP_STATE_ON_EXCEPTION maybe another one would make sense INCLUDE_SIZE_IN_STATE_DUMP, which would control the inclusion of the RamUsageEstimator.

    java.lang.ClassNotFoundException: com.private.Representation
          at java.net.URLClassLoader.findClass(URLClassLoader.java:381) ~[na:1.8.0_66]
          at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_66]
          at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_66]
          at java.lang.Class.getDeclaredFields0(Native Method) ~[na:1.8.0_66]
          at java.lang.Class.privateGetDeclaredFields(Class.java:2583) ~[na:1.8.0_66]
          at java.lang.Class.getDeclaredFields(Class.java:1916) ~[na:1.8.0_66]
          at com.carrotsearch.sizeof.RamUsageEstimator.createCacheEntry(RamUsageEstimator.java:568) ~[java-sizeof-0.0.4.jar:na]
          at com.carrotsearch.sizeof.RamUsageEstimator.measureSizeOf(RamUsageEstimator.java:532) ~[java-sizeof-0.0.4.jar:na]
          at com.carrotsearch.sizeof.RamUsageEstimator.sizeOfAll(RamUsageEstimator.java:380) ~[java-sizeof-0.0.4.jar:na]
          at com.carrotsearch.sizeof.RamUsageEstimator.sizeOfAll(RamUsageEstimator.java:361) ~[java-sizeof-0.0.4.jar:na]
          at ma.glasnost.orika.StateReporter.humanReadableSizeInMemory(StateReporter.java:48) ~[orika-core-1.4.6.jar:na]
          at ma.glasnost.orika.impl.DefaultMapperFactory.reportCurrentState(DefaultMapperFactory.java:1559) ~[orika-core-1.4.6.jar:na]
          at ma.glasnost.orika.StateReporter.reportCurrentState(StateReporter.java:33) ~[orika-core-1.4.6.jar:na]
          at ma.glasnost.orika.impl.ExceptionUtility.decorate(ExceptionUtility.java:65) ~[orika-core-1.4.6.jar:na]
          at ma.glasnost.orika.impl.MapperFacadeImpl.resolveMappingStrategy(MapperFacadeImpl.java:209) ~[orika-core-1.4.6.jar:na]
          at ma.glasnost.orika.impl.MapperFacadeImpl.map(MapperFacadeImpl.java:741) ~[orika-core-1.4.6.jar:na]
          at ma.glasnost.orika.impl.MapperFacadeImpl.map(MapperFacadeImpl.java:721) ~[orika-core-1.4.6.jar:na]
          at ma.glasnost.orika.impl.ConfigurableMapper.map(ConfigurableMapper.java:150) ~[orika-core-1.4.6.jar:na]
    ...
    

    Another weird thing I noticed when logging all classes the RamUsageEstimator looks at, is that it looks at way too many classes in com.carrotsearch.sizeof.RamUsageEstimator#createCacheEntry which should not be part of the mapping.

    enhancement 
    opened by leonard84 9
  • Roadmap for 1.5.1?

    Roadmap for 1.5.1?

    Hi,

    I'm just wondering what still needs to be done for a 1.5.1 release. There isn't a milestone for it and I think the java 8 time API changes alone would already warrant a new release.
    Anything I can do to help to get a new release out?

    regards, Hannes

    opened by 123Haynes 8
  • PassThroughConverter is ignored for org.joda.time.DateTime

    PassThroughConverter is ignored for org.joda.time.DateTime

    Orika is using a CustomMapper when trying to map org.joda.time.DateTime. But it should not because the ConverterFactory of the MapperFactory has the following PassThroughConverter registered:

    MapperFactory mapperFactory = new DefaultMapperFactory.Builder().build(); mapperFactory.getConverterFactory() .registerConverter(new PassThroughConverter(LocalDateTime.class, DateTime.class, DateTimeZone.class)); return mapperFactory;

    this is the stackTrace: org.joda.time.IllegalFieldValueException: Value 46874266 for millisOfSecond must be in the range [0,999] at org.joda.time.field.FieldUtils.verifyValueBounds(FieldUtils.java:252) at org.joda.time.chrono.BasicChronology.getDateTimeMillis(BasicChronology.java:175) at org.joda.time.chrono.AssembledChronology.getDateTimeMillis(AssembledChronology.java:133) at org.joda.time.base.BaseDateTime.(BaseDateTime.java:258) at org.joda.time.base.BaseDateTime.(BaseDateTime.java:227) at org.joda.time.DateTime.(DateTime.java:503) at ma.glasnost.orika.generated.DateTime_DateTime_ObjectFactory1661753990812576582459846$2473.create(DateTime_DateTime_ObjectFactory1661753990812576582459846$2473.java) at ma.glasnost.orika.impl.mapping.strategy.InstantiateAndUseCustomMapperStrategy.getInstance(InstantiateAndUseCustomMapperStrategy.java:55) at ma.glasnost.orika.impl.mapping.strategy.UseCustomMapperStrategy.map(UseCustomMapperStrategy.java:66) at ma.glasnost.orika.impl.DefaultBoundMapperFacade.map(DefaultBoundMapperFacade.java:137) at ma.glasnost.orika.generated.Orika_HPayment_Payment_Mapper255637972574$1052.mapAtoB(Orika_HPayment_Payment_Mapper255637972574$1052.java) at ma.glasnost.orika.impl.mapping.strategy.UseCustomMapperStrategy.map(UseCustomMapperStrategy.java:72) at ma.glasnost.orika.impl.MapperFacadeImpl.map(MapperFacadeImpl.java:254) at ma.glasnost.orika.impl.MapperFacadeImpl.mapElement(MapperFacadeImpl.java:802) at ma.glasnost.orika.impl.MapperFacadeImpl.mapAsCollection(MapperFacadeImpl.java:626) at ma.glasnost.orika.impl.MapperFacadeImpl.mapAsList(MapperFacadeImpl.java:432) at ma.glasnost.orika.generated.Orika_HOrder_Order_Mapper255661587375$1054.mapAtoB(Orika_HOrder_Order_Mapper255661587375$1054.java) at ma.glasnost.orika.impl.GeneratedMapperBase.mapAtoB(GeneratedMapperBase.java:128) at ma.glasnost.orika.generated.Orika_HOrder_Order_Mapper255755435848$1058.mapAtoB(Orika_HOrder_Order_Mapper255755435848$1058.java) at ma.glasnost.orika.impl.mapping.strategy.UseCustomMapperStrategy.map(UseCustomMapperStrategy.java:72) at ma.glasnost.orika.impl.DefaultBoundMapperFacade.map(DefaultBoundMapperFacade.java:137) at ma.glasnost.orika.generated.Orika_HGapsProtocol_GapsProtocol_Mapper806652820437$1575.mapAtoB(Orika_HGapsProtocol_GapsProtocol_Mapper806652820437$1575.java) at ma.glasnost.orika.impl.mapping.strategy.UseCustomMapperStrategy.map(UseCustomMapperStrategy.java:72) at ma.glasnost.orika.impl.MapperFacadeImpl.map(MapperFacadeImpl.java:676) at ma.glasnost.orika.impl.MapperFacadeImpl.map(MapperFacadeImpl.java:655) at it.obb.ts.backend.order.shared.util.AbstractMapper.map(AbstractMapper.java:31) at it.obb.ts.backend.order.repository.AbstractRepository.map(AbstractRepository.java:18) at it.obb.ts.backend.order.repository.HibernateGapsProtocolRepositoryImpl.save(HibernateGapsProtocolRepositoryImpl.java:28) at sun.reflect.GeneratedMethodAccessor1156.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:139) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) at it.obb.ts.backend.order.shared.aspect.timeout.TimeoutInterruptAspect.timeoutAround(TimeoutInterruptAspect.java:19) at sun.reflect.GeneratedMethodAccessor116.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:620) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:609) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) at it.obb.ts.backend.order.shared.aspect.metric.MetricsAspect.timed(MetricsAspect.java:89) at sun.reflect.GeneratedMethodAccessor120.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:620) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:609) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) at com.sun.proxy.$Proxy246.save(Unknown Source) at sun.reflect.GeneratedMethodAccessor1156.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:133) at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:121) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) at com.sun.proxy.$Proxy247.save(Unknown Source) at it.obb.ts.backend.order.services.utils.GapsProtocolAdapter.log(GapsProtocolAdapter.java:42) at it.obb.ts.backend.order.services.impl.GapsProtocolService.log(GapsProtocolService.java:67) at it.obb.ts.backend.order.services.impl.GapsProtocolService$$FastClassBySpringCGLIB$$64f7ca39.invoke() at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:139) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) at it.obb.ts.backend.order.shared.aspect.timeout.TimeoutInterruptAspect.timeoutAround(TimeoutInterruptAspect.java:19) at sun.reflect.GeneratedMethodAccessor116.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:620) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:609) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) at it.obb.ts.backend.order.shared.aspect.metric.MetricsAspect.timed(MetricsAspect.java:89) at sun.reflect.GeneratedMethodAccessor120.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:620) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:609) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655) at it.obb.ts.backend.order.services.impl.GapsProtocolService$$EnhancerBySpringCGLIB$$35bfaafb.log() at it.obb.ts.backend.order.services.processing.impl.CleanupProcessor.finishCleanupOrder(CleanupProcessor.java:236) at it.obb.ts.backend.order.services.processing.impl.CleanupProcessor.cleanupPayment(CleanupProcessor.java:164) at it.obb.ts.backend.order.services.processing.impl.CleanupProcessor.doCleanupPayments(CleanupProcessor.java:140) at it.obb.ts.backend.order.services.processing.impl.CleanupProcessor.cleanupPayments(CleanupProcessor.java:124) at it.obb.ts.backend.order.services.processing.impl.CleanupProcessor$$FastClassBySpringCGLIB$$91fd6928.invoke() at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.validation.beanvalidation.MethodValidationInterceptor.invoke(MethodValidationInterceptor.java:139) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655) at it.obb.ts.backend.order.services.processing.impl.CleanupProcessor$$EnhancerBySpringCGLIB$$41e62988.cleanupPayments() at it.obb.ts.backend.order.web.impl.OrderWSImpl.cleanupPayments(OrderWSImpl.java:223) at sun.reflect.GeneratedMethodAccessor1903.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:302) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) at it.obb.ts.backend.order.shared.aspect.timeout.TimeoutInterruptAspect.timeoutAround(TimeoutInterruptAspect.java:19) at sun.reflect.GeneratedMethodAccessor116.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:620) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:609) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:85) at it.obb.ts.backend.order.shared.aspect.metric.MetricsAspect.timed(MetricsAspect.java:89) at it.obb.ts.backend.order.shared.aspect.metric.MetricsAspect.setThreadLocalAndTimed(MetricsAspect.java:77) at sun.reflect.GeneratedMethodAccessor146.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:620) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:609) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:68) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:168) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) at com.sun.proxy.$Proxy305.cleanupPayments(Unknown Source) at sun.reflect.GeneratedMethodAccessor1903.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:180) at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96) at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:189) at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:99) at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59) at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:96) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308) at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:254) at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:234) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:208) at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:160) at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:180) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:298) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPut(AbstractHTTPServlet.java:234) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:273) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:101) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:107) at it.obb.ts.core.logging.LoggingServletFilter.doFilter(LoggingServletFilter.java:62) at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:112) at it.obb.ts.core.logging.MDCServletFilter.doFilter(MDCServletFilter.java:42) at org.springframework.web.filter.CompositeFilter$VirtualFilterChain.doFilter(CompositeFilter.java:112) at org.springframework.web.filter.CompositeFilter.doFilter(CompositeFilter.java:73) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) at it.obb.ts.core.webservice.security.SwaggerUiFilter.doFilterInternal(SwaggerUiFilter.java:25) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:166) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:96) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:528) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1099) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:670) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745)

    opened by JohnHaze 8
  • Remove Paranamer dependency  from orika core project

    Remove Paranamer dependency from orika core project

    Hi,

    We don't need com.thoughtworks.paranamer dependency as java has inbuilt functionality for it.

    We are using couple for opensource libraries and easy brings its own paranamer and it causes ClassNotFoundException.

    opened by rajcspsg 7
  • orika default mapping breaks when registering classMap with only byDefault()

    orika default mapping breaks when registering classMap with only byDefault()

    In oasp.io we actually created a facade for bean mappers such as dozer, orika, or MapStruct to prevent coupling to an fixed implementation and the being bound to it. We started with Dozer but want to switch to Orika as default. However, we are facing a strange issue: The default mapping of Orika works but we want to add a specific custom mapping. Doing so broke the default mapping and our test. I now discovered that already adding the classMap for my A/B mapping with mapper.classMap(A.class, B.class).byDefault().register() already breaks the defaults and prevents some fields from being mapped.

    Here is our test-case on github if you want to have a look (the use-case is quite simple so I am surprised that orika already fails with this setup, but we might do something wrong): https://github.com/oasp/oasp4j/blob/develop/oasp4j-modules/oasp4j-beanmapping/src/test/java/io/oasp/module/beanmapping/common/impl/BeanMapperImplOrikaTest.java

    inactive 
    opened by hohwille 7
  • Orika does not map has[boolean field] as it does for is[boolean field]

    Orika does not map has[boolean field] as it does for is[boolean field]

    Currently we can map boolean like that

        public class A  {
            private boolean blue;
    
            public boolean isBlue() {
                return blue;
            }
    
            public void setBlue(boolean blue) {
                this.blue = blue;
            }
        }
    

    to

        public class B  {
            private boolean blue;
    
            public boolean isBlue() {
                return blue;
            }
    
            public void setBlue(boolean blue) {
                this.blue = blue;
            }
        }
    

    But we cannot map automatically "has" boolean like this

        public class A  {
            private boolean access;
    
            public boolean hasAccess() {
                return access;
            }
    
            public void setAccess(boolean access) {
                access = access;
            }
        }
    

    to

        public class B  {
            private boolean access;
    
            public boolean hasAccess() {
                return access;
            }
    
            public void setAccess(boolean access) {
                access = access;
            }
        }
    

    We have to map those kind of boolean fields using a custom mapper

    opened by thermech 6
  • Cannot register converters after MapperFacade has been initialized

    Cannot register converters after MapperFacade has been initialized

    Hi,

    I am not able to register any converters after the initial configure() has taken placen, including ANY field level converter... Whenever I try, I am getting the following error: Cannot register converters after MapperFacade has been initialized

    BR, Mannan

    question 
    opened by boss94 6
  • Optimize MapperGenerator class so that there will be no method code length limit

    Optimize MapperGenerator class so that there will be no method code length limit

    Hello! Recently I encountered a problem with defining mapping for large legacy classes with many nested fields.

    Class MapperGeneratorin method private Set<FieldMap> addMapMethod(SourceCodeContext code, boolean aToB, ClassMap<?, ?> classMap, StringBuilder logDetails) combines all class map field mappings into one method. So when there are many field mappings and fields have long names there might occur an "Method code too large exception" during initializing generated mapping classes at runtime. The standard limit in JDK for method length is 64k.

    I looked up one of the generated mapping class in my code and it's method has almost 7k lines :). Is there any workaround for this problem?

    opened by Rayti 0
  • Provide built-in support for type com.fasterxml.jackson.databind.JsonNode

    Provide built-in support for type com.fasterxml.jackson.databind.JsonNode

    This is a new feature request.

    Currently, the only means to map JSON objects to beans is by using Orika's support for Map<String,Object>. We were hoping it would support mapping from JsonNode to our beans, too.

    In order to keep Orika's list of dependencies low, it could be implemented in another Maven artifact (orika-jackson?), or by using Maven <scope>provided</scope> for the Jackson dependency.

    opened by matthewadams 0
  • Wrong ObjectFactory generated when destination object has no args and all args constructor

    Wrong ObjectFactory generated when destination object has no args and all args constructor

    Source class:

    public class Data {
      private List<Entity> entities;
    
      public List<Entity> getEntities() {
        return entities;
      }
    
      public void setEntities(List<Entity> entities) {
        this.entities = entities;
      }
    }
    

    Destination class:

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public class DataDTO {
    
      private List<InnerEntity> innerDtoEntities;
    
    }
    
    public class Entity {
      private List<InnerEntity> innerEntities;
    
      public List<InnerEntity> getInnerEntities() {
        return innerEntities;
      }
    
      public void setInnerEntities(List<InnerEntity> innerEntities) {
        this.innerEntities = innerEntities;
      }
    }
    
    public class InnerEntity {
      private String field;
    
      public String getField() {
        return field;
      }
    
      public void setField(String field) {
        this.field = field;
      }
    }
    

    Mapping written like this:

    mapperFactory.classMap(Data.class, DataDTO.class)
            .field("entities{innerEntities}", "innerDtoEntities")
            .mapNulls(true)
            .mapNullsInReverse(true)
            .byDefault()
            .register();
    

    Generated ObjectFactory method:

    public Object create(Object s, ma.glasnost.orika.MappingContext mappingContext) {if(s == null) throw new java.lang.IllegalArgumentException("source object must be not null");if (s instanceof test.Data) {test.Data source = (test.Data) s;
    try {
    
    java.util.List arg0 = null; if ( !(((java.util.List)source.getInnerEntities()) == null)) {
    
    java.util.List new_arg0 = ((java.util.List)new java.util.ArrayList()); 
    
    new_arg0.addAll(mapperFacade.mapAsList(((java.util.List)source.getInnerEntities()), ((ma.glasnost.orika.metadata.Type)usedTypes[0]), ((ma.glasnost.orika.metadata.Type)usedTypes[0]), mappingContext)); 
    arg0 = new_arg0; 
    } else {
     if ( !(arg0 == null)) {
    arg0 = null;
    };
    }return new test.DataDTO(arg0);
    } catch (java.lang.Exception e) {
    
    if (e instanceof RuntimeException) {
    
    throw (RuntimeException)e;
    
    } else {
    throw new java.lang.RuntimeException("Error while constructing new DataDTO instance", e);
    }
    }
    }return new test.DataDTO();
    }
    

    I'm getting Caused by: javassist.compiler.CompileError: getInnerEntities() not found in test.Data

    In generated ObjectFactory it tries to getInnerEntities from Data - (java.util.List)source.getInnerEntities(), howevever, InnerEntity dos not belong to Data directly

    Not sure if I'm doing the right mapping here and it is not supported by Orika or it's a bug.

    opened by knfs9 1
  • Performed refactoring techniques to make the code more clear

    Performed refactoring techniques to make the code more clear

    The following refactoring techniques were applied:

    1. Rename the variable: The file "Mapping Context.java" had a boolean variable called isNew and it has been changed to isNewConcreteClass due to behavior and usage of that variable for knowing whether the concrete class has been introduced or not.
    2. Extract Method: The file " ScoringClassMapBuilder.java" had a code of block, which was converted into a method named "getUnmatchedFields()" to specify which fields will be mapped and the remaining ones will be unmatched, which gets returned by the mentioned function.
    3. Move Method: A new class called "ElementTypeClass.java" was created, which had the method called "defaultElementType()" and was moved to the given class due to its implementation from the original class called "Property.java" and later called in this class.
    4. Push-Down Method: A method named "List asList(Object[] iterable)" was pushed down from a class called "GeneratedObjectBase.java" to a class called "GeneratedObjectFactory" as to it belonged more to the former one due to its functionality.
    5. Pull-Up Method: The changes were made to three inter-related interfaces having a superclass and subclass relationship. The method called "void setMapperFactory()" was moved into the interface called "BaseSpecificition.java", which was implemented by the two interfaces called "Specification.java" and "AggregateSpecification.java".
    6. opened by Rutvik-09 0
    7. bean has list<Map> can't do trans completed!

      bean has list can't do trans completed!

      public class DataWrapper {

      List<Map<String,Object>> list=new ArrayList<Map<String,Object>>();
      
      public DataWrapper(){
          Map<String,Object> map=new HashMap<String,Object>();
          map.put("dafa","ddd");
          map.put("daffa","mmmm");
          list.add(map);
      }
      
      public List<Map<String, Object>> getList() {
          return list;
      }
      
      public void setList(List<Map<String, Object>> list) {
          this.list = list;
      }
      

      }

      public class ChengbinDescribe extends PersonSource {

      private DataWrapper auths;
      
      
      public DataWrapper getAuths() {
          return auths;
      }
      
      public void setAuths(DataWrapper auths) {
          this.auths = auths;
      }
      

      }

      public class StudentSource {

      private DataWrapper auths;
      
      public DataWrapper getAuths() {
          return auths;
      }
      
      public void setAuths(DataWrapper auths) {
          this.auths = auths;
      }
      

      }

      public static void main(String[] args) throws Exception{ ChengbinDescribe twoSource=new ChengbinDescribe(); InnerBean innerBean=new InnerBean(); DataWrapper wrapper=new DataWrapper(); List<Map<String,Object>> list=new ArrayList<Map<String,Object>>(); Map<String,Object> map=new HashMap<String,Object>(); map.put("chengbin","host"); map.put("cxt","hust"); list.add(map); map=new HashMap<String,Object>(); map.put("keys","kust"); map.put("key2","kbst"); list.add(map); wrapper.setList(list); wrapper.getList().addAll(innerBean.buskMap()); twoSource.setAuths(wrapper); // twoSource.setInnerBean(innerBean); //twoSource.setInnerBean(innerBean); //json Utils can do it StudentSource studentSource2=EntityUtils.toBean(twoSource,StudentSource.class); System.out.println(EntityUtils.toJson(twoSource)); StudentSource studentSource1=OrikaMapperUtils.transBean(twoSource,StudentSource.class); //System.out.println(studentSource1.getUserMap()); System.out.println(studentSource2); System.out.println(studentSource1.getAuths().getList()); System.out.println(EntityUtils.toJson(studentSource1)); }

      {"auths":{"list":[{"chengbin":"host","cxt":"hust"},{"key2":"kbst","keys":"kust"},{"dafa":"ddd","daffa":"mmmm"}]}} StudentSource@771a660 [{}, {}, {}] {"auths":{"list":[{},{},{}]}}

      jsonutils can't do it,but this is not can do it!

      WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by ma.glasnost.orika.converter.builtin.CloneableConverter (file:/D:/DevSourceDir/GradleLocalSource/caches/modules-2/files-2.1/ma.glasnost.orika/orika-core/1.5.4/b4f1019bfeda6d6aa0790a42f2d317151d2d2f4d/orika-core-1.5.4.jar) to method java.lang.Object.clone() WARNING: Please consider reporting this to the maintainers of ma.glasnost.orika.converter.builtin.CloneableConverter WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release

      opened by chengbinTechnology 2
    8. dOOv (Domain Object Oriented Validation) a fluent API for type-safe bean validation and mapping

      dOOv (Domain Object Oriented Validation) dOOv is a fluent API for typesafe domain model validation and mapping. It uses annotations, code generation a

      dOOv 77 Nov 20, 2022
      Selma Java bean mapping that compiles

      Selma Java bean mapping at compile time ! What is Selma ? S3lm4 say Selma, stands for Stupid Simple Statically Linked Mapper. In fact it is on one sid

      Publicis Sapient Engineering 210 Nov 2, 2022
      Elegance, high performance and robustness all in one java bean mapper

      JMapper Framework Fast as hand-written code with zero compromise. Artifact information Status Write the configuration using what you prefer: Annotatio

      null 200 Dec 29, 2022
      An annotation processor for generating type-safe bean mappers

      MapStruct - Java bean mappings, the easy way! What is MapStruct? Requirements Using MapStruct Maven Gradle Documentation and getting help Building fro

      null 5.8k Dec 31, 2022
      Intelligent object mapping

      ModelMapper ModelMapper is an intelligent object mapping library that automatically maps objects to each other. It uses a convention based approach wh

      ModelMapper 2.1k Dec 28, 2022
      A declarative mapping library to simplify testable object mappings.

      ReMap - A declarative object mapper Table of Contents Long story short About ReMap Great News Mapping operations Validation Features Limitations The m

      REMONDIS IT Services GmbH & Co. KG 103 Dec 27, 2022
      Dozer is a Java Bean to Java Bean mapper that recursively copies data from one object to another.

      Dozer Active Contributors We are always looking for more help. The below is the current active list: Core @garethahealy @orange-buffalo ?? Protobuf @j

      null 2k Jan 5, 2023
      dOOv (Domain Object Oriented Validation) a fluent API for type-safe bean validation and mapping

      dOOv (Domain Object Oriented Validation) dOOv is a fluent API for typesafe domain model validation and mapping. It uses annotations, code generation a

      dOOv 77 Nov 20, 2022
      dOOv (Domain Object Oriented Validation) a fluent API for type-safe bean validation and mapping

      dOOv (Domain Object Oriented Validation) dOOv is a fluent API for typesafe domain model validation and mapping. It uses annotations, code generation a

      dOOv 77 Nov 20, 2022
      Selma Java bean mapping that compiles

      Selma Java bean mapping at compile time ! What is Selma ? S3lm4 say Selma, stands for Stupid Simple Statically Linked Mapper. In fact it is on one sid

      Publicis Sapient Engineering 210 Nov 2, 2022
      This is a Meme repo for fixed & Cleaned source of 'Better'Bungeecord but its not realy better code is trash!

      #Fucking cleaned by CryCodes Disclaimer: Based of MD_5's Bungeecord (Fork of "BetterBungee") | I am not the owner of the code This repo is just for fu

      Rooks 3 Jan 2, 2022
      A MATLAB-like scientific scripting environment for Kotlin, a simpler Kotlin only version of KotlinLab

      KotlinLab: Easy and effective MATLAB-like scientific programming with Kotlin and Java JShell Installation The installation of KotlinLab is very simple

      Stergios Papadimitriou 11 Sep 28, 2022
      Table-Computing (Simplified as TC) is a distributed light weighted, high performance and low latency stream processing and data analysis framework. Milliseconds latency and 10+ times faster than Flink for complicated use cases.

      Table-Computing Welcome to the Table-Computing GitHub. Table-Computing (Simplified as TC) is a distributed light weighted, high performance and low la

      Alibaba 34 Oct 14, 2022
      DAO oriented database mapping framework for Java 8+

      Doma Doma 2 is a database access framework for Java 8+. Doma has various strengths: Verifies and generates source code at compile time using annotatio

      domaframework 353 Dec 28, 2022
      Reladomo is an enterprise grade object-relational mapping framework for Java.

      Reladomo What is it? Reladomo is an object-relational mapping (ORM) framework for Java with the following enterprise features: Strongly typed compile-

      Goldman Sachs 360 Nov 2, 2022
      A library for IDEs and Code Editors to compile java projects faster dynamically

      A library for IDEs and Code Editors to compile java projects faster dynamically

      omega ui 2 Feb 22, 2022
      Mars - Object Relational Mapping Framework for MongoDB (MongoDB ORM)

      Mars Object Relational Mapping Framework for MongoDB 致自己 造自己的轮子,让别人去说 ; What is Mars Mars is a unified driver platform product developed by Shanghai J

      null 35 Nov 17, 2022
      Elegance, high performance and robustness all in one java bean mapper

      JMapper Framework Fast as hand-written code with zero compromise. Artifact information Status Write the configuration using what you prefer: Annotatio

      null 200 Dec 29, 2022
      Library for converting from one Java class to a dissimilar Java class with similar names based on the Bean convention

      Beanmapper Beanmapper is a Java library for mapping dissimilar Java classes with similar names. The use cases for Beanmapper are the following: mappin

      null 26 Nov 15, 2022