Skip to content

Commit

Permalink
Feature/checked chaining (#2)
Browse files Browse the repository at this point in the history
* Fix README layout
* Add failing test to illustrate intended usage of Checked object
* Add assumption-assert to test case
* Start implementing Checked guard clause
* Add class level test for InvalidObjectException
* Implementation of GUARD behaviour
* Add instantiation test for Validations utility class
* Add class level tests for Checked objects guard clause
* Refactor: Refining concepts

The concepts of 'Checked' and 'ModularValidator' were leaky, as the
objects and their intent were not accurately represented by their names.

* Rename 'Checked' to 'Evaluated'
* Renamed 'ModularValidator' to 'ModularRuleset'
* Update documentation
* Restructure dependency directions
* Implement fail-fast behaviour in GUARD
* Update documentation

* Update documentation

---------

Co-authored-by: stijn-dejongh <stijn-dejongh@users.noreply.github.com>
  • Loading branch information
stijn-dejongh and stijn-dejongh authored Dec 26, 2023
1 parent 4277768 commit d2357ba
Show file tree
Hide file tree
Showing 175 changed files with 30,652 additions and 2,072 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
push:
branches:
- '!main'
- '!release/**'
- 'feature/**'

jobs:
build:
Expand Down
19 changes: 11 additions & 8 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
# Modular Validators

| [![Quality gate](https://sonarcloud.io/api/project_badges/quality_gate?project=sddevelopment-be_modular-validators)](https://sonarcloud.io/summary/new_code?id=sddevelopment-be_modular-validators) | [Test report](serenity/) | [JavaDoc](apidocs/) |

A lightweight validation framework for the JVM, allowing for internal and external validation logic to be combined in a transparent and reusable
A lightweight validation framework for the JVM, allowing for internal and external validation logic to be combined in a transparent and reusable
way.

| [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=sddevelopment-be_modular-validators&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=sddevelopment-be_modular-validators) | [Test report](serenity/) | [JavaDoc](apidocs/) |

---

<!-- TOC -->
* [Modular Validators](#modular-validators)
* [Value statement](#value-statement)
* [Problem](#problem)
* [Proposed solution](#proposed-solution)
* [Contributing](#contributing)
* [Value statement](#value-statement)
* [Problem](#problem)
* [Proposed solution](#proposed-solution)
* [Contributing](#contributing)
<!-- TOC -->

---

## Value statement

### Problem
Expand Down
34 changes: 19 additions & 15 deletions docs/apidocs/allclasses-index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (21) on Mon Dec 25 06:25:40 CET 2023 -->
<!-- Generated by javadoc (21) on Tue Dec 26 12:38:29 UTC 2023 -->
<title>All Classes and Interfaces (modular-validators 1.0.0-SNAPSHOT API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2023-12-25">
<meta name="dc.created" content="2023-12-26">
<meta name="description" content="class index">
<meta name="generator" content="javadoc/AllClassesIndexWriter">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
Expand Down Expand Up @@ -52,32 +52,36 @@
<h1 title="All Classes and Interfaces" class="title">All Classes and Interfaces</h1>
</div>
<div id="all-classes-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="all-classes-table-tab0" role="tab" aria-selected="true" aria-controls="all-classes-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('all-classes-table', 'all-classes-table', 2)" class="active-table-tab">All Classes and Interfaces</button><button id="all-classes-table-tab2" role="tab" aria-selected="false" aria-controls="all-classes-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('all-classes-table', 'all-classes-table-tab2', 2)" class="table-tab">Classes</button><button id="all-classes-table-tab3" role="tab" aria-selected="false" aria-controls="all-classes-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('all-classes-table', 'all-classes-table-tab3', 2)" class="table-tab">Enum Classes</button><button id="all-classes-table-tab4" role="tab" aria-selected="false" aria-controls="all-classes-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('all-classes-table', 'all-classes-table-tab4', 2)" class="table-tab">Record Classes</button></div>
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="all-classes-table-tab0" role="tab" aria-selected="true" aria-controls="all-classes-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('all-classes-table', 'all-classes-table', 2)" class="active-table-tab">All Classes and Interfaces</button><button id="all-classes-table-tab2" role="tab" aria-selected="false" aria-controls="all-classes-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('all-classes-table', 'all-classes-table-tab2', 2)" class="table-tab">Classes</button><button id="all-classes-table-tab3" role="tab" aria-selected="false" aria-controls="all-classes-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('all-classes-table', 'all-classes-table-tab3', 2)" class="table-tab">Enum Classes</button><button id="all-classes-table-tab4" role="tab" aria-selected="false" aria-controls="all-classes-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('all-classes-table', 'all-classes-table-tab4', 2)" class="table-tab">Record Classes</button><button id="all-classes-table-tab5" role="tab" aria-selected="false" aria-controls="all-classes-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('all-classes-table', 'all-classes-table-tab5', 2)" class="table-tab">Exception Classes</button></div>
<div id="all-classes-table.tabpanel" role="tabpanel">
<div class="summary-table two-column-summary" aria-labelledby="all-classes-table-tab0">
<div class="table-header col-first">Class</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab2"><a href="be/sddevelopment/validation/Checked.html" title="class in be.sddevelopment.validation">Checked&lt;T&gt;</a></div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab2"><a href="be/sddevelopment/validation/Constrainable.html" title="class in be.sddevelopment.validation">Constrainable&lt;T&gt;</a></div>
<div class="col-last even-row-color all-classes-table all-classes-table-tab2">
<div class="block">Checked class.</div>
<div class="block">Evaluated class.</div>
</div>
<div class="col-first odd-row-color all-classes-table all-classes-table-tab4"><a href="be/sddevelopment/validation/Constraint.html" title="class in be.sddevelopment.validation">Constraint&lt;T&gt;</a></div>
<div class="col-last odd-row-color all-classes-table all-classes-table-tab4">
<div class="block">ValidationRule class.</div>
</div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab2"><a href="be/sddevelopment/validation/Constraint.ValidationRuleBuilder.html" title="class in be.sddevelopment.validation">Constraint.ValidationRuleBuilder&lt;T&gt;</a></div>
<div class="col-last even-row-color all-classes-table all-classes-table-tab2">&nbsp;</div>
<div class="col-first odd-row-color all-classes-table all-classes-table-tab3"><a href="be/sddevelopment/validation/Evaluation.html" title="enum class in be.sddevelopment.validation">Evaluation</a></div>
<div class="col-last odd-row-color all-classes-table all-classes-table-tab3">
<div class="block">Evaluation class.</div>
</div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab2"><a href="be/sddevelopment/validation/EvaluationRationale.html" title="class in be.sddevelopment.validation">EvaluationRationale</a></div>
<div class="col-last even-row-color all-classes-table all-classes-table-tab2">&nbsp;</div>
<div class="col-first odd-row-color all-classes-table all-classes-table-tab2"><a href="be/sddevelopment/validation/ModularValidator.html" title="class in be.sddevelopment.validation">ModularValidator&lt;T&gt;</a></div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab5"><a href="be/sddevelopment/validation/InvalidObjectException.html" title="class in be.sddevelopment.validation">InvalidObjectException</a></div>
<div class="col-last even-row-color all-classes-table all-classes-table-tab5">&nbsp;</div>
<div class="col-first odd-row-color all-classes-table all-classes-table-tab2"><a href="be/sddevelopment/validation/ModularRuleset.html" title="class in be.sddevelopment.validation">ModularRuleset&lt;T&gt;</a></div>
<div class="col-last odd-row-color all-classes-table all-classes-table-tab2">&nbsp;</div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab2"><a href="be/sddevelopment/validation/ModularValidator.ModularValidatorBuilder.html" title="class in be.sddevelopment.validation">ModularValidator.ModularValidatorBuilder&lt;S&gt;</a></div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab2"><a href="be/sddevelopment/validation/ModularRuleset.ModularValidatorBuilder.html" title="class in be.sddevelopment.validation">ModularRuleset.ModularValidatorBuilder&lt;S&gt;</a></div>
<div class="col-last even-row-color all-classes-table all-classes-table-tab2">&nbsp;</div>
<div class="col-first odd-row-color all-classes-table all-classes-table-tab4"><a href="be/sddevelopment/validation/Reason.html" title="class in be.sddevelopment.validation">Reason</a></div>
<div class="col-last odd-row-color all-classes-table all-classes-table-tab4">
<div class="block">Reason class.</div>
</div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab4"><a href="be/sddevelopment/validation/ValidationRule.html" title="class in be.sddevelopment.validation">ValidationRule&lt;T&gt;</a></div>
<div class="col-first odd-row-color all-classes-table all-classes-table-tab2"><a href="be/sddevelopment/validation/Rationale.html" title="class in be.sddevelopment.validation">Rationale</a></div>
<div class="col-last odd-row-color all-classes-table all-classes-table-tab2">&nbsp;</div>
<div class="col-first even-row-color all-classes-table all-classes-table-tab4"><a href="be/sddevelopment/validation/Reason.html" title="class in be.sddevelopment.validation">Reason</a></div>
<div class="col-last even-row-color all-classes-table all-classes-table-tab4">
<div class="block">ValidationRule class.</div>
<div class="block">Reason class.</div>
</div>
<div class="col-first odd-row-color all-classes-table all-classes-table-tab2"><a href="be/sddevelopment/validation/Validations.html" title="class in be.sddevelopment.validation">Validations</a></div>
<div class="col-last odd-row-color all-classes-table all-classes-table-tab2">
Expand Down
4 changes: 2 additions & 2 deletions docs/apidocs/allpackages-index.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (21) on Mon Dec 25 06:25:40 CET 2023 -->
<!-- Generated by javadoc (21) on Tue Dec 26 12:38:29 UTC 2023 -->
<title>All Packages (modular-validators 1.0.0-SNAPSHOT API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2023-12-25">
<meta name="dc.created" content="2023-12-26">
<meta name="description" content="package index">
<meta name="generator" content="javadoc/AllPackagesIndexWriter">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">
Expand Down
27 changes: 25 additions & 2 deletions docs/apidocs/be/sddevelopment/validation/Checked.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (21) on Mon Dec 25 06:25:40 CET 2023 -->
<!-- Generated by javadoc (21) on Tue Dec 26 08:27:52 UTC 2023 -->
<title>Checked (modular-validators 1.0.0-SNAPSHOT API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="dc.created" content="2023-12-25">
<meta name="dc.created" content="2023-12-26">
<meta name="description" content="declaration: package: be.sddevelopment.validation, class: Checked">
<meta name="generator" content="javadoc/ClassWriterImpl">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
Expand Down Expand Up @@ -120,6 +120,12 @@ <h2>Method Summary</h2>
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#guard(java.lang.String)" class="member-name-link">guard</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;errorMessage)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#isInvalid()" class="member-name-link">isInvalid</a>()</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code>boolean</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4"><code><a href="#isValid()" class="member-name-link">isValid</a>()</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab4">&nbsp;</div>
Expand Down Expand Up @@ -153,6 +159,12 @@ <h3>isValid</h3>
</section>
</li>
<li>
<section class="detail" id="isInvalid()">
<h3>isInvalid</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">boolean</span>&nbsp;<span class="element-name">isInvalid</span>()</div>
</section>
</li>
<li>
<section class="detail" id="of(T)">
<h3 id="of(java.lang.Object)">of</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="type-parameters">&lt;T&gt;</span>&nbsp;<span class="return-type"><a href="Checked.html" title="class in be.sddevelopment.validation">Checked</a>&lt;T&gt;</span>&nbsp;<span class="element-name">of</span><wbr><span class="parameters">(T&nbsp;toValidate)</span></div>
Expand All @@ -164,6 +176,17 @@ <h3>rationale</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/Optional.html" title="class or interface in java.util" class="external-link">Optional</a>&lt;<a href="EvaluationRationale.html" title="class in be.sddevelopment.validation">EvaluationRationale</a>&gt;</span>&nbsp;<span class="element-name">rationale</span>()</div>
</section>
</li>
<li>
<section class="detail" id="guard(java.lang.String)">
<h3>guard</h3>
<div class="member-signature"><span class="modifiers">public</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">guard</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;errorMessage)</span>
throws <span class="exceptions"><a href="InvalidObjectException.html" title="class in be.sddevelopment.validation">InvalidObjectException</a></span></div>
<dl class="notes">
<dt>Throws:</dt>
<dd><code><a href="InvalidObjectException.html" title="class in be.sddevelopment.validation">InvalidObjectException</a></code></dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
Expand Down
Loading

0 comments on commit d2357ba

Please sign in to comment.