Add NetexId one-line utility like NetexIdUtils#242
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a new no.entur.abt.netex.id.NetexId static facade intended to be a faster, legacy-shaped one-liner API built on the existing validator/parser internals, and updates documentation and benchmarks accordingly.
Changes:
- Introduces
NetexIdfacade with one-line helpers for create/derive/validate/extract operations. - Adds
DefaultNetexIdValidator.validateToValueIndex(...)to support fast value-part replacement without regex/splitting. - Adds unit tests, a new JMH benchmark, and README documentation + updated benchmark results.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/main/java/no/entur/abt/netex/id/NetexId.java |
New modern static facade wrapping existing validator/parser behavior. |
src/main/java/no/entur/abt/netex/id/DefaultNetexIdValidator.java |
Adds validateToValueIndex helper used by the facade for fast derivation. |
src/test/java/no/entur/abt/netex/id/NetexIdTest.java |
Adds unit tests for the new facade API behavior. |
src/test/java/no/entur/abt/netex/id/DefaultNetexIdValidatorTest.java |
Adds tests for validateToValueIndex. |
src/test/perf/no/entur/abt/netex/id/jmh/NetexIdFacadeBenchmark.java |
New JMH benchmark comparing facade vs legacy NetexIdUtils. |
src/test/perf/no/entur/abt/netex/id/jmh/BenchmarkMain.java |
Includes the new facade benchmark in the benchmark runner. |
README.md |
Documents the new facade and updates performance section/results. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Initial plan * Add null check for valuePart in NetexId.createFrom Co-authored-by: skjolber <1031478+skjolber@users.noreply.github.com> Agent-Logs-Url: https://github.com/entur/netex-utils/sessions/3f77131e-18b7-42cd-ac26-f9e31c020c12 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: skjolber <1031478+skjolber@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
….java Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Initial plan * Fix test method name to follow consistent naming convention Co-authored-by: skjolber <1031478+skjolber@users.noreply.github.com> Agent-Logs-Url: https://github.com/entur/netex-utils/sessions/c651361f-f48d-4c62-ae7a-251da51332f9 --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: skjolber <1031478+skjolber@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
erlendnils1
left a comment
There was a problem hiding this comment.
I can't see any reason why we would want to keep the legacy behavior? If this is worth doing we should replace the existing impl (while keeping the existing api)
| && validateValue(string, last + 1, string.length()); | ||
| } | ||
|
|
||
| public int validateToValueIndex(CharSequence string) { |
| */ | ||
|
|
||
| /** | ||
| * Modern utility facade with legacy-like one-liner methods. |
There was a problem hiding this comment.
Comment is a bit confusing? Should it at least describe the purpose of the class before describing modern/legacy?
Leave legacy class as-is, implement a faster 1-1 substitute based on existing parsers/validators/etc.
TODO: Too conservative to keep all legacy behaviour?