[
https://issues.apache.org/jira/browse/ARTEMIS-4796?focusedWorklogId=922145&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-922145
]
ASF GitHub Bot logged work on ARTEMIS-4796:
-------------------------------------------
Author: ASF GitHub Bot
Created on: 05/Jun/24 11:20
Start Date: 05/Jun/24 11:20
Worklog Time Spent: 10m
Work Description: gemmellr commented on code in PR #4959:
URL: https://github.com/apache/activemq-artemis/pull/4959#discussion_r1627254132
##########
artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java:
##########
@@ -56,20 +56,37 @@ public final class SimpleString implements CharSequence,
Serializable, Comparabl
* @param string String used to instantiate a SimpleString.
* @return A new SimpleString
*/
- public static SimpleString toSimpleString(final String string) {
+ public static SimpleString of(final String string) {
if (string == null) {
return null;
}
return new SimpleString(string);
}
- public static SimpleString toSimpleString(final String string,
StringSimpleStringPool pool) {
+ public static SimpleString of(final String string, StringSimpleStringPool
pool) {
if (pool == null) {
- return toSimpleString(string);
+ return of(string);
}
return pool.getOrCreate(string);
}
+ public static SimpleString of(final byte[] data) {
+ return new SimpleString(data);
+ }
+
+ public static SimpleString of(final char c) {
+ return new SimpleString(c);
+ }
+
+ @Deprecated(forRemoval = true)
+ public static SimpleString toSimpleString(final String string) {
+ return of(string);
+ }
+
+ @Deprecated(forRemoval = true)
+ public static SimpleString toSimpleString(final String string,
StringSimpleStringPool pool) {
+ return of(string, pool);
+ }
Review Comment:
In this type of change its typical to have javadoc @ deprecated as well,
indicating the replacement that should be used instead. E.g here the
constructor is not deprecated (related question: should it also be?), so
someone might notice the deprecation and switch to the constructor instead
rather than the new 'of'.
Issue Time Tracking
-------------------
Worklog Id: (was: 922145)
Time Spent: 40m (was: 0.5h)
> Simplify SimpleString API
> -------------------------
>
> Key: ARTEMIS-4796
> URL: https://issues.apache.org/jira/browse/ARTEMIS-4796
> Project: ActiveMQ Artemis
> Issue Type: Improvement
> Reporter: Justin Bertram
> Assignee: Justin Bertram
> Priority: Major
> Time Spent: 40m
> Remaining Estimate: 0h
>
> Instead of using the verbosely named {{toSimpleString}} static factory method
> (and its overloaded counterparts), {{SimpleString}} should provide {{of}}
> implementations. This change would make the code more concise and readable.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact