[ 
https://issues.apache.org/jira/browse/ARTEMIS-4796?focusedWorklogId=922240&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-922240
 ]

ASF GitHub Bot logged work on ARTEMIS-4796:
-------------------------------------------

                Author: ASF GitHub Bot
            Created on: 05/Jun/24 18:50
            Start Date: 05/Jun/24 18:50
    Worklog Time Spent: 10m 
      Work Description: jbertram commented on code in PR #4959:
URL: https://github.com/apache/activemq-artemis/pull/4959#discussion_r1628281605


##########
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:
   I fleshed out the JavaDoc on both the old and new methods as well as 
deprecating the constructors.





Issue Time Tracking
-------------------

    Worklog Id:     (was: 922240)
    Time Spent: 2h  (was: 1h 50m)

> 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: 2h
>  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


Reply via email to