Skip to content

shoopman/cylone

Repository files navigation

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);

About

Cyclone is a light-weight library to convert pojos.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages