Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 10.0 #12

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open

Release 10.0 #12

wants to merge 19 commits into from

Conversation

cowwoc
Copy link
Owner

@cowwoc cowwoc commented Jul 29, 2024

No description provided.

…is optimized-away by the JIT. Unnecessary checks for null only cost a few nanoseconds.

* Wrapped value in MaybeUndefined.
* Added GenericType for casting to types with type parameters.
* Refactored code to improve reuse
\-> Binary size increased due to the use of lambdas, but code should be easier to maintain.

* Removed MutableStringMappers.toString(Object). Use StringMappers.toString(Object) instead.
* Moved classes from com.github.cowwoc.requirements.java.type to com.github.cowwoc.requirements.java.validator.
* StringMapper.apply(object) now takes a second parameter: StringMapper.apply(object, seen).
* Removed unused png files.

* Design discussion
  * Why separate primitive and boxes validators? For convenience, not as much for performance-reasons. JMH benchmarks on changeset eb7463f reveal that
    * There is a 3% performance gain if we separate validators for boxed and primitive types. This includes arrays.
    * There is a 5% performance gain if we separate validator for long and int primitive types.
    * The only real downside of using boxed types everywhere is that `getValue()` returns a nullable type even if we know that the value will not be null.
    * Arrays of primitive types are different because Java does not box `int[]` as `Integer[]`.
@cowwoc cowwoc force-pushed the release-10.0 branch 2 times, most recently from 808c1c9 to 6cc9d1e Compare July 29, 2024 17:17
* Added Validator.add() and Validator.or() logical operators.
* Removed all type converters from ObjectValidator and StringValidator because the concept does not scale. We can't just keep on adding methods to these centralized classes.
…t that()"

* Removed all public references to the validator configuration and the ability to create custom validator factories.
* Renamed Configuration.lazyExceptions to recordStacktrace.
* Use normal StampedLock because we don't actually need a reentrant lock.
…aximumIsExclusive.

* Renamed lazyExceptions to recordStacktrace.
* Implemented GenericType.isPrimitive().
* Removed UrlValidator since it doesn't do anything after converters have been removed.
* Removed more references to "Configuration" from the public API.
* Removed GenericType.asArrayComponent().
* Renamed MaybeUndefined to ValidationTarget.
* Improve readability of validations using ValidationTarget.validationFailed() method.
* ValidationTarget only wraps the value being validated. Optional parameters are null if omitted or undefined.
* Removed all type-conversion methods.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant