Modelmapper advanced use of Java

Source: Internet
Author: User

Modelmapper is a Java object Automatic mapping of the third-party rack package, easy to use, with Ali's Frstjson can greatly simplify the background code.

But Modelmapper Chinese use instructions very little, the official website http://modelmapper.org/explanation is also very unclear, so I studied for a long time.

Modelmapper Modelmapper =NewModelmapper (); Modelmapper.addmappings (NewPropertymap<anentity, adto>() {            protected voidConfigure () {//property name is different, set the corresponding relationship yourself//source generates the target class, destination the data source class, these two words can be interpreted as two pointers, substituting the reference classmap (). SetText (Source.getdescription ()); //Some properties are not mapped//property is an object that can be as followsSkip (). Setdtoonlyproperty (NULL); //property is not an object'sSkip (Destination.getid ());//you can set the properties on the source, or you can set the properties of the destination            }        }); Adto Adto= Modelmapper.map (Entity, adto.class);

More advanced applications can refer to http://www.talangsoft.org/2015/04/20/domain_mapping_with_modelmapper/this English blog, there is no way to Chinese too little ~ ~

Hope this article is helpful to everyone, after all, the study of playing a few hours head is dizzy ~ ~ by the way, modelmapper performance is not very good (but also after the ghosts know the cycle of the less, but their own less a lot of also recognized) to correct use or there will be a stutter ~ ~

Modelmapper advanced use of Java

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.