Skip to content

Add NetexId one-line utility like NetexIdUtils#242

Open
skjolber wants to merge 10 commits intomainfrom
netexIdUtilEquivalent
Open

Add NetexId one-line utility like NetexIdUtils#242
skjolber wants to merge 10 commits intomainfrom
netexIdUtilEquivalent

Conversation

@skjolber
Copy link
Copy Markdown
Contributor

@skjolber skjolber commented Mar 20, 2026

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?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 NetexId facade 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.

Comment thread src/main/java/no/entur/abt/netex/id/NetexId.java
Comment thread src/main/java/no/entur/abt/netex/id/NetexId.java
Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 20, 2026

@skjolber I've opened a new pull request, #243, to work on those changes. Once the pull request is ready, I'll request review from you.

skjolber and others added 2 commits March 21, 2026 00:16
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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/test/perf/no/entur/abt/netex/id/jmh/NetexIdFacadeBenchmark.java Outdated
Comment thread src/main/java/no/entur/abt/netex/id/DefaultNetexIdValidator.java Outdated
Comment thread src/test/java/no/entur/abt/netex/id/NetexIdTest.java
….java

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 20, 2026

@skjolber I've opened a new pull request, #245, to work on those changes. Once the pull request is ready, I'll request review from you.

skjolber and others added 2 commits March 21, 2026 00:34
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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread src/test/perf/no/entur/abt/netex/id/jmh/NetexIdFacadeBenchmark.java
Comment thread src/test/java/no/entur/abt/netex/id/NetexIdTest.java
@skjolber skjolber requested a review from a team March 20, 2026 23:55
Copy link
Copy Markdown
Contributor

@erlendnils1 erlendnils1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Javadoc?

*/

/**
* Modern utility facade with legacy-like one-liner methods.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment is a bit confusing? Should it at least describe the purpose of the class before describing modern/legacy?

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.

4 participants