Entity Comparator

A simple Comparator which can be configured to compare only certain properties of an object.

Лицензия

Лицензия

Категории

Категории

Ant Компиляция и сборка
Группа

Группа

com.github.carlopantaleo
Идентификатор

Идентификатор

entity-comparator
Последняя версия

Последняя версия

1.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

Entity Comparator
A simple Comparator which can be configured to compare only certain properties of an object.
Ссылка на сайт

Ссылка на сайт

https://github.com/carlopantaleo/entity-comparator
Система контроля версий

Система контроля версий

https://github.com/carlopantaleo/entity-comparator

Скачать entity-comparator

Как подключить последнюю версию

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

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
com.google.guava : guava jar 25.0-jre

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

Entity Comparator

Build Status codecov jitpack

A simple Comparator which lets you compare objects by dynamically choosing the properties to compare.

Please note: if you are using Java 8 or later, please consider the standard Comparator class.

Get it

Add the latest version dependency to your POM:

<dependency>
    <groupId>com.github.carlopantaleo</groupId>
    <artifactId>entity-comparator</artifactId>
    <version>1.0.1</version>
</dependency>

Example usage

public class Example {
	private String field1;
	private String field2;
	
	// Getters and setters
	// ...
}

Example ex1 = new Example();
ex1.setField1("a");
ex1.setField2("a");

Example ex2 = new Example();
ex2.setField1("a");
ex2.setField2("b");

EntityComparator<Example> ec = new EntityComparator<>(Example.class);
ec.addComparingProperty("field1");
assertEquals(0, ec.compare(ex1, ex2));
ec.addComparingProperty("field2");
assertEquals(-1, ec.compare(ex1, ex2));

Версии библиотеки

Версия
1.0.1