Sumatera

@Sumatera Model converter from ORM class to regular pojo class, the ORM term is a modelling class that doesn't like regular pojo, such like @Entity from JPA/Hibernate and so on. It can be used for mapping regular object, post data in request body where you cannot put ORM class directly in a parameter, or you cannot convert to json directly, or any other problem regarding it. You don't need anymore to create duplicate Dto / Pojo class which represent ORM class, just write your ORM class and annotate it with @Sumatera, then the regular pojo class would be generated for you.

License

License

GroupId

GroupId

io.github.febialfarabi
ArtifactId

ArtifactId

sumatera
Last Version

Last Version

1.0.22
Release Date

Release Date

Type

Type

jar
Description

Description

Sumatera
@Sumatera Model converter from ORM class to regular pojo class, the ORM term is a modelling class that doesn't like regular pojo, such like @Entity from JPA/Hibernate and so on. It can be used for mapping regular object, post data in request body where you cannot put ORM class directly in a parameter, or you cannot convert to json directly, or any other problem regarding it. You don't need anymore to create duplicate Dto / Pojo class which represent ORM class, just write your ORM class and annotate it with @Sumatera, then the regular pojo class would be generated for you.
Project URL

Project URL

https://github.com/febiAlfarabi/pojoing
Source Code Management

Source Code Management

https://github.com/febiAlfarabi/pojoing

Download sumatera

How to add to project

<!-- https://jarcasting.com/artifacts/io.github.febialfarabi/sumatera/ -->
<dependency>
    <groupId>io.github.febialfarabi</groupId>
    <artifactId>sumatera</artifactId>
    <version>1.0.22</version>
</dependency>
// https://jarcasting.com/artifacts/io.github.febialfarabi/sumatera/
implementation 'io.github.febialfarabi:sumatera:1.0.22'
// https://jarcasting.com/artifacts/io.github.febialfarabi/sumatera/
implementation ("io.github.febialfarabi:sumatera:1.0.22")
'io.github.febialfarabi:sumatera:jar:1.0.22'
<dependency org="io.github.febialfarabi" name="sumatera" rev="1.0.22">
  <artifact name="sumatera" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.github.febialfarabi', module='sumatera', version='1.0.22')
)
libraryDependencies += "io.github.febialfarabi" % "sumatera" % "1.0.22"
[io.github.febialfarabi/sumatera "1.0.22"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

@Sumatera

Model converter from ORM class to regular pojo class, the ORM term is a modelling class that doesn't like regular pojo, such like @Entity from JPA/Hibernate and so on.

It can be used for mapping regular object, post data in request body where you facing issue when you put ORM object directly in a parameter, or you cannot convert to json directly, or any other problem regarding it.

You don't need anymore to create duplicate Dto / Pojo class which represent ORM class, just write your ORM class and annotate it with @Sumatera, then the regular pojo class would be generated for you.

Example

@Entity
@Table
@Sumatera
public class Person{

    String name ;

    String address ;

    @Nias(ignore = true)
    String secured;
}

The above code will automatically generate a duplicate java and also compiled class called PersonDto where you can find in the generated-source folder inside your maven project.

public class PersonDto{

    String name ;

    String address ;

    public String getName() {  
	    return this.name;  
    }
    public void setName(String name) {  
	    this.name = name;  
    }
    public String getAddress() {  
	    return this.address;  
    }
    public void setAddress(String address) {  
	    this.address = address;  
    }
}

By Default a class uses @Sumatera for automatically generate the duplicate class pojo and its assume that all of class field are should be generated.

In special situation, where you need to ignore some field you can use @Nias(ignore=true) on the field.

@Nias(ignore = true)
String secured ;

There is also 2 static return methods generated in your pojo class

PersonORM personOrm = PersonDto.to(personDto);
PersonDto personDto = PersonDto.from(personOrm);

The above methods would be automatically convert your type of object between any ORM from-to Dto/Pojo

How To Use

Add this dependency maven project

<dependency>  
    <groupId>io.github.febialfarabi</groupId>
    <artifactId>sumatera</artifactId>
    <version>1.0.21</version>
</dependency>

Happy Coding..!!

Thanks for

  • Apache
  • javapoet
  • toolisticon
  • jackson
  • modelmapper

The Alfarabi License

Copyright (C) 2020 Alfarabi Dwi Karuniawan. All rights reserved This software is the confidential and proprietary information of Alfarabi Dwi Karuniawan. You shall not disclose such confidential information and shall use it only in accordance with the terms of the license agreement you entered into with Alfarabi Dwi Karuniawan.

Versions

Version
1.0.22
1.0.21
1.0.17
1.0.16
1.0.14
1.0.13
1.0.12
1.0.11
1.0.10
1.0.9
1.0.8
1.0.7
1.0.6
1.0.3