https://github.com/nergal-perm/java-decita
Java library to make decisions based on decision tables
https://github.com/nergal-perm/java-decita
decision-tables java
Last synced: 3 months ago
JSON representation
Java library to make decisions based on decision tables
- Host: GitHub
- URL: https://github.com/nergal-perm/java-decita
- Owner: nergal-perm
- License: mit
- Created: 2023-12-27T18:46:18.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-07-10T14:15:56.000Z (12 months ago)
- Last Synced: 2026-01-01T08:23:43.337Z (6 months ago)
- Topics: decision-tables, java
- Language: Java
- Homepage: https://nergal-perm.github.io/java-decita/
- Size: 2.28 MB
- Stars: 6
- Watchers: 3
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# java-decita
[](https://www.0pdd.com/p?name=nergal-perm/java-decita)
[](https://hitsofcode.com/github/nergal-perm/java-decita/view)
## Instructions
### Publishing a site
First of all, the site should be built with the following Maven command:
```shell
mvn clean verify site -Pjacoco && mvn site:site site:stage -Psite
```
Then I `rsync` the newly created `target/staging` folder to another copy of the repository (which has
the `gh-pages` branch checked out) with the following command (run from the project root):
```shell
rsync -avz --delete target/staging/* ../java-decita-gh-pages/
```
After that, I 'cd' to the repository's copy, commit and push the changes to the `gh-pages` branch.
Done!
### Releasing
To create a new commit with a new version, run the following `npx` command (you need to have Node.js installed):
```shell
npx @dwmkerr/standard-version --package-files pom.xml --bumpFiles pom.xml
```
After that run the following Maven command to push the new version to the Maven Central:
```shell
mvn clean deploy -Pjcabi-gpg -PnewSonatype
```
The publishing process is still very manual, so it's needed to check out the
[Sonatype Nexus](https://central.sonatype.com/publishing/deployments) page for the deployed
artifacts and to release them manually.
### Adding as a dependency
To add this library as a dependency to your project, add the following to your `pom.xml`:
```xml
io.github.nergal-perm
java-decita
LATEST
```
## Decision table DSL (CSV format)
For the decision table to be processed, it should be in CSV format with semicolon (`;`) as a separator.
The columns of the table represent rules, except for the first one, which contains the "base" of each
condition. The rows in the first section (before `---`) represent the conditions, and the rows in the second
section (after `---`) represent the outcomes.
Every value in the conditions section should refer to a specific data fragment, which can be located
by its description, called `Coordinate`. Coordinates consist of two parts: `Locator` - that is the
name of the data domain, and `Identifier` - that is the name of the data fragment. Those parts are separated
by `::`. For example, value `ui_button_create::enabled` refers to the `enabled` fragment of the
`ui_button_create` locator.
For the constant values, the `Locator` part can be omitted, so the value `5` refers to a constant value `5`.
For the sake of completeness, the `Locator` part for constant values is `constant`, so it is possible to
write `constant::5` instead of just `5` (but it is not necessary).
The table cells in the conditions section should contain the condition description, consisting of
the logical operator (if any), followed by the comparison operator (if any), followed by the value.
If the comparison operator is omitted, it is assumed to be `==`, which means that the "base" value of
the condition should be equal to the cell value for the condition to be true. Other comparison operators
are `>` and `<`.
The logical operators are used to modify the condition itself. The operator `~` means "any", so it is
effectively means that the condition is always true. The operator `!` means "not", so it negates the
specified condition.