Coder Social home page Coder Social logo

selma's Introduction

Build Status Build Status

S3lm4 logo

What is S3lm4 ?

S3lm4 stands for Stupid Simple Staticaly Linked Mapper. In fact it is on one side an Annotation Processor that generate Java code to handle the mapping from field to field at compile time. On the other side, it is a Runtime library to instantiate and invoke the generated Mapper.

How does it works ?

First add selma-processor as a provided dependency and selma as a compile dependency to your build. Then, define a Mapper interface describing the mapping you want:

@Mapper
public interface SelmaMapper {

    OutBean asOutBean(InBean in);

}

Then ? Well just use the generated Mapper:

    SelmaMapper mapper = Selma.mapper(SelmaMapper.class).build();

    OutBean res = mapper.asOutBean(in);

And voilà !

Features

  • Generate code for mapping bean to bean matching fields to fields ** Support for nested bean ** Bean should respect Java property convention
  • Maps Enum using identical values
  • Maps Collection any to any
  • Maps Map any to any
  • Use strict memory duplication for all fields
  • Support for Factory to instantiate beans is out of the box
  • Support Type to Type custom mapping using custom mapping static methods
  • Gives full feedback at compilation time
  • Break build when mapping does not work Say good bye to mapping errors in production

Usage

First add selma and selma-processor to your pom dependencies:

        <!-- scope provided because the processor is only needed for the compiler -->
        <dependency>
            <groupId>fr.xebia.extras</groupId>
            <artifactId>selma-processor</artifactId>
            <version>0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>

        <!-- This is the only real dependency you will have in youre binaries -->
        <dependency>
            <groupId>fr.xebia.extras</groupId>
            <artifactId>selma</artifactId>
            <version>0.1-SNAPSHOT</version>
        </dependency>

Then, as I said earlier, build youre interface with @Mapper annotation and enjoy.

Checkout the example module to have a deeper look.

Help needed, please report issues and ask for features :)

selma's People

Contributors

slemesle avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.