Package io.mats3.util
Class SanitizeMqNames
java.lang.Object
io.mats3.util.SanitizeMqNames
Utility class for replacing dodgy characters from queue/topic names, and names in general, in the Message Broker
world - it is quite restrictive, replacing any character not in [a-z,A-Z,0-9,.,_,-] (lower alpha, upper alpha,
digits, dot, underscore, minus/dash) with '_'.
The code is literally:
.. but the compiled pattern is statically cached. Its functionality may very well be copied to where its logic is needed if not desired to depend on 'mats-util'.
Pattern.compile("[^a-zA-Z0-9._\\-]").matcher(input).replaceAll("_")
.. but the compiled pattern is statically cached. Its functionality may very well be copied to where its logic is needed if not desired to depend on 'mats-util'.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
sanitizeName
(String input) Sanitizes the input, only allowing [a-z,A-Z,0-9,.,-,_] (last being dot, minus, underscore)
-
Field Details
-
MQ_NAME_REPLACE_PATTERN
-
-
Constructor Details
-
SanitizeMqNames
public SanitizeMqNames()
-
-
Method Details
-
sanitizeName
Sanitizes the input, only allowing [a-z,A-Z,0-9,.,-,_] (last being dot, minus, underscore)- Parameters:
input
- the name to sanitize- Returns:
- the name after being run through the code
'
Pattern.compile("[^a-zA-Z0-9._\\-]").matcher(input).replaceAll("_")
'.
-