-
-
Notifications
You must be signed in to change notification settings - Fork 146
feat(key): Add KeyFormat to improve custom Key creation #1227
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
base: main/4
Are you sure you want to change the base?
Conversation
|
As for #1249, im unsure on what best to name that method, as we can't have another A: B: I like A more, just cause it makes more sense to me and sounds better (at least in my head). But, we would be breaking consistency with I understand that the methods in |
|
Another thing I thought about recently, is that it might be better to move the actual logic of creating/checking parsability of keys into the key format class. All the overloads I added in Key could be removed then and the existing ones just forward into |
|
Went ahead and implemented option A now, can always just rename the methods again if required. |
|
For consistency, we can use the name But ofc, I'm not a maintainer, just my thoughts on the topic. |
25493c0 to
bb89288
Compare
This pull request adds a
KeyFormatclass to allow for easier creation of custom Keys using the API.KeyFormathas following functionality:namespaceto be used when no other namespace is specified in the key parsingseparatorto be used when parsing keysKeyFormat#parse(String)which parses a input string using the configured separator and fallback namespaceKeyFormat#key(String)which creates a key using the configured namespace and the input string as valueKeyFormat#parseable(String)to check if a input string can be parsed using the configuration of the key formatKeyFormat#asString(Key)to turn a key into a String using the configurationKeyFormat#asMinimalString(Key)to turn a Key into its minimal String using the configurationAdditionally, extends
Keyby following functionality:Key#parseable(String, char)to specify the separator character when checking if a string can be parsed into a keyKey#parseable(String, char, String)to specify the fallback namespace used when none is provided in the input stringKey#key(String, char, String)to specify the fallback namespace used when none is provided in the input stringCloses #1222