Cylone

A light-weight library to convert pojos

License

License

Categories

Categories

Net
GroupId

GroupId

net.meku.cylone
ArtifactId

ArtifactId

cylone-core
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

Cylone
A light-weight library to convert pojos
Project URL

Project URL

https://github.com/shoopman/cylone
Source Code Management

Source Code Management

https://github.com/shoopman/cylone

Download cylone-core

How to add to project

<!-- https://jarcasting.com/artifacts/net.meku.cylone/cylone-core/ -->
<dependency>
    <groupId>net.meku.cylone</groupId>
    <artifactId>cylone-core</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/net.meku.cylone/cylone-core/
implementation 'net.meku.cylone:cylone-core:1.0.0'
// https://jarcasting.com/artifacts/net.meku.cylone/cylone-core/
implementation ("net.meku.cylone:cylone-core:1.0.0")
'net.meku.cylone:cylone-core:jar:1.0.0'
<dependency org="net.meku.cylone" name="cylone-core" rev="1.0.0">
  <artifact name="cylone-core" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.meku.cylone', module='cylone-core', version='1.0.0')
)
libraryDependencies += "net.meku.cylone" % "cylone-core" % "1.0.0"
[net.meku.cylone/cylone-core "1.0.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.apache.commons : commons-lang3 jar 3.8.1
org.springframework.data : spring-data-commons jar 2.1.10.RELEASE
org.slf4j : slf4j-simple jar 1.7.25

Project Modules

There are no modules declared in this project.

Introduction

Cyclone is a light-weight library to convert pojos.

Usage

Introduce to your project

Gradle build.gradle

    compile("net.meku.cylone:cylone:1.0-SNAPSHOT")

Maven pom.xml

	<dependency>
		<groupId>net.meku.cylone</groupId>
		<artifactId>cylone</artifactId>
		<version>1.0-SNAPSHOT</version>
	</dependency>
        

Convert your pojos

First, create your own converters.

public class AttachmentConverter extends BeanCopyPojoConverter<Attachment, AttachmentView> {
    
    protected void afterBeanCopy(AttachmentView source, Attachment target) {
        // do something
    }
}

Now you can convert your pojos.

    AttachmentConverter converter = new AttachmentConverter();
    Attachment model = converter.toPojo(view);
    List<Attachment> models = converter.toList(views);

Use SimpleConverter if you only have simple properties to pass between pojos.

    SimpleConverter<Article, ArticleView> converter = new SimpleConverter<>();
    Article model = new Article();
    converter.toPojo(view, model);

Versions

Version
1.0.0