-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
common: update ByteSizeParser to follow builder pattern
Motivation: ByteSizeParser supports a fluent interface for configuration, ostensibly following the builder pattern. However, the Builder class never actually builds the desired object; instead, parsing is done through the builder. This behaviour is potentially confusing for people familiar with the builder pattern. Modification: Add a build method to the ByteSizeParser.Builder class that returns a ByteSizeParser object. Parsing is now done through this returned object. As the ByteSizeParser object is now immutable, may be safely used as a constant (static final). This allows the separation of the parser definition from the use of the parser, potentially making code easier to read. The regular expression FSM is delayed until the first use. This is to avoid a (very minor) performance regression on start-up. The FSM is then reused, providing a (very minor) performance improvement if the parser is used more than once. Result: No user or admin observable changes. Slightly easier to understand code. Target: master Requires-notes: no Requires-book: no Patch: https://rb.dcache.org/r/13121/ Acked-by: Lea Morschel Acked-by: Albert Rossi
- Loading branch information
1 parent
6809690
commit 5bf281a
Showing
9 changed files
with
118 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.