Skip to content
/ jeneric Public

A tiny library for collection of custom yet frequently used function and helper, build on top of Java 8 Standard API

License

Notifications You must be signed in to change notification settings

mkdika/jeneric

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

90 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Jeneric

License: Apache-2.0 Build Status codecov Maven Javadocs

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.

Overview

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.

Used Tool and Library

  • 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.

Quickstart

Setting up dependency

Maven

<dependency>
	<groupId>com.mkdika</groupId>
	<artifactId>jeneric</artifactId>
	<version>1.0.0</version>
</dependency>

Gradle

dependencies {
    compile 'com.mkdika:jeneric:1.0.0'
}

Usage

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        
    }
}

Build, Testing and Install

Pre-requirement

Build

To build from source, run this from project root:

mvn clean package

Check target folder, and search for jeneric-<version>.jar, for built file.

Test

Unit Test and Coverage Test

Run this from project root:

mvn test

Check folder and open file target/site/jacoco/index.html, for Jacoco coverage test result.

Mutation Test

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.

Install in Local Maven Repository

To install into local Maven repository for development testing purpose, run this from project root:

mvn install

Documentation

  • For online host most recent version javadoc, please visit Javadoc.
  • For user guide, please visit User Guide.

Maintainer

Contributions are very welcome, please read How to contribute.

License

Licensed under the Apache License, Version 2.0. See LICENSE file.

About

A tiny library for collection of custom yet frequently used function and helper, build on top of Java 8 Standard API

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages