A tiny library for collection of custom yet frequently used function and helper. Build on top of Java 8 standard API, no external libraries is needed.
The main idea behind creating of this another helper and common use function library,
is to ease the usage of specific and frequently functions call, that the practical usage
may not available on other library. Furthermore, Jeneric also provide a high level access
from Java static
method call or expression, so it does not require to instance certain
object prior usage. And as the result, functions supposed to be able to directly use and practical.
Jeneric is also a tiny library, the release size are relatively small (just less than 30 KB
), and
used only Java 8 standard API. So, it may suit to any Java 8 project or mobile development (Android).
The collection of each functions are organize within parent class that base on its expected return types.
There are several parent class such as StringFun
, BooleanFun
, DateFun
, IntegerFun
, etc.
For more explanation and code examples, please visit User Guide.
- Java 8
- Maven3, as build system and dependency management.
- Unit Testing:
- JUnit4, as unit testing framework.
- Java Hamcrest, for ease matcher and more human readable equality test.
- JUnitParams, for ease parameterized test.
- Mockito, a mock test framework.
- Jacoco, a code coverage library.
- Pitest, State of the art mutation testing system for the JVM.
<dependency>
<groupId>com.mkdika</groupId>
<artifactId>jeneric</artifactId>
<version>1.0.0</version>
</dependency>
dependencies {
compile 'com.mkdika:jeneric:1.0.0'
}
This is a sample usage of Jeneric's function:
import com.mkdika.jeneric.function.DateFun;
import com.mkdika.jeneric.function.StringFun;
import java.util.Date;
public class JenericTest {
public static void main(String[] args) {
Date d1 = DateFun.of(2018, 4, 28, 19, 35, 25); // 28 Apr 2018 19:35:25
Date d2 = DateFun.of(2018, 5, 23, 12, 30, 45); // 23 May 2018 12:30:45
System.out.println(StringFun.elapsedTime(d1, d2));
// print: 24 days 16 hours 55 minutes 20 seconds 0 milliseconds
}
}
- Install Java 8 JDK.
- Install Maven3.
To build from source, run this from project root:
mvn clean package
Check target
folder, and search for jeneric-<version>.jar
, for built file.
Run this from project root:
mvn test
Check folder and open file target/site/jacoco/index.html
, for Jacoco coverage test result.
Additionally after built the project you can run the mutation test as well (please note it may need some time to finish), run this from project root:
mvn org.pitest:pitest-maven:mutationCoverage
Check folder and open file target/pit-reports/<YYYYMMDDHHMI>/index.html
, for PiTest mutation test result.
To install into local Maven repository for development testing purpose, run this from project root:
mvn install
- For online host most recent version javadoc, please visit Javadoc.
- For user guide, please visit User Guide.
Contributions are very welcome, please read How to contribute.
Licensed under the Apache License, Version 2.0. See LICENSE file.