README.md

Cranberry

             ___/\\ /\  
            / _//| \ /  
           / / / |/ \__ 000   000
           |/ /  / /  000       000
      00 00 _/   |/ 000       ^   000
   00 ^     00   | 000     <  *  > 000  
  00< * >    00 0 0 000       v   000
   00 v     00 0 * 0  000       000
      00 00     0 0     000   000
________________________________________
Cranberry          

The Cranberry is a java library that allows to write less routine code. It’s automatically plugs into you build during compilation and sweets up your project.

Maven Central Sonatype Nexus Release Sonatype Nexus Snapshot javadoc

tag release

osslifecycle last_commit release_date

DeepSource Codacy Badge

licence Contributor Covenant FOSSA Status

repo_size languages_code_size languages_count languages_top

requires_java

📇 Table of Contents

📖 About

The Cranberry is a java library that allows to write less routine code. It’s automatically plugs into you build during compilation and sweets up your project.

Motivation

Sometimes it wants frequently used code to be generated automatically. Especially if such code is not generated by existing libraries.

Modules

The cranberry project includes the follows modules:

  • cranberry commons - this module provides a general realisation of simple tools and wrappers which are used in another cranberry modules for the automatically code generating during compilation;
  • cranberry muffin - this module is designed to combine the possibilities of thematically grouped modules into one common library;
  • cranberry statement - this module provides an api for the statements validation (such as not null and e.t.c.). This module includes an annotations for the injecting methods of this api into code during compilation;
  • cranberry logging - this module provides an api for the loggint method params;
  • cranberry data - this module provides an api for the java data manipulations: varianbles modifiers, default values, e.t.c. This module includes an annotations for the injecting methods of this api into code during compilation;
  • cranberry tests - this module contains the unit tests for the remaining modules of the cranberry project.

📸 Demo

The demonstration shows how cranberry helps to write less code on the checking parameters implementation example for non-emptiness via usage of the @ NotEmpty annotation from the cranberry-statement module. This is one of opportunities which cranberry provides.

The demo of cranberry statement usage

🎚 Features

  • The api for the statements validation about not null values of the Object type;
  • The api for the statements validation about not empty values of the Map type, the Collection type, the Array and the String type;
  • The api for the statements validation about not blank values of the String type;
  • The api for the loggint method params;
  • The annotations for the injecting methods of this api into code during compilation.

To Do

  • For more information on an upcoming development, please read the todo list.

Changelog

  • For more information on a releases, a features and a changes, please read the changelog notes.

🚦 Getting Started

These instructions allow to get a copy of this project and run it on a local machine.

Prerequisites

Before using it, make sure that follows software are installed on the local machine:

Installing

Using Maven

In order to add cranberry to your project it is quite simple to:

1 - Add this dependency to classpath in pom:

<dependency>
    <groupId>io.github.ololx.cranberry</groupId>
    <artifactId>${module-name}</artifactId>
    <version>${version}</version>
</dependency>

Example of dependency for installing cranberry-muffin module with version 0.5.3 is presented bellow

<dependency>
    <groupId>io.github.ololx.cranberry</groupId>
    <artifactId>cranberry-muffin</artifactId>
    <version>0.5.3</version>
    <scope>provided</scope>
</dependency>

2 - Execute this with goal

clean install

Cloning

For the cloning this repository to a local machine, just use the follows link:

https://github.com/ololx/cranberry

Using

The simple example below presents the the checking of a parameters on not null value without the specific exception message returns and not blank value with the specific exception message returns.

 ...
//Add the checking statements for method params
public List<SomeDetail> findSomeDetailbyUidAndTypeCode(@NotNull Long uid, 
    @NotEmpty("The Type Code must be not empty") String typeCode) {
    return Collections.EMPTY_LIST;
}
...

The simple example below presents the the logging of a parameters of method with the specific message.

...
/**
 * The example of {@code @LogParam} annotation usage on {@code List<String> param}.
 * <p>
 * When this method is called, the parameters will be displayed in the log;
 * Messages in the log will label the format {@char "message param"} for each parameter.
 */
@LogParam(message = "Start execution with param =")
public static void runWithCustomMessage(List<String> param) {
    param.stream()
            .forEach(eachParam -> {
                System.out.println(eachParam);
            });
}
...

🛠 Built With

  • Maven - Dependency Management.

🎉 Contributing

If you want to contribute this project - you are welcome and have fun. Please visit the contributing section for details on this code of conduct, and the process for submitting pull requests.

📝 Code of Conduct

In order to ensure that all is welcoming, please review and abide by the code of conduct.

🗒 Versioning

For the versioning is used Semantic Versioning. For the versions available, see the changelog or the tags on this repository.

©️ Authors

  • Alexander A. Kropotin - Initial work - ololx.

🔏 Licensing

This project is licensed under the Apache license version 2.0 - see the lisence document for details.

FOSSA Status

Описание

The cranberry is a java library that allows to write less code - it's automatically plugs into your project build and sweets up your java.

Конвейеры
0 успешных
0 с ошибкой