You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/11/30 12:20:48 UTC

[GitHub] [shardingsphere] TeslaCN commented on a change in pull request #13852: support sql comment hint.

TeslaCN commented on a change in pull request #13852:
URL: https://github.com/apache/shardingsphere/pull/13852#discussion_r759223736



##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/hint/HintManager.java
##########
@@ -186,6 +189,24 @@ public static boolean isInstantiated() {
         return null != HINT_MANAGER_HOLDER.get();
     }
     
+    /**
+     * Set datasource name.
+     *
+     * @param datasourceName datasource name
+     */
+    public void setDatasourceName(final String datasourceName) {
+        this.datasourceName = datasourceName;
+    }
+    
+    /**
+     * Get datasource name.
+     *
+     * @return datasource name
+     */
+    public static Optional<String> getDatasourceName() {
+        return null != HINT_MANAGER_HOLDER.get() ? Optional.ofNullable(HINT_MANAGER_HOLDER.get().datasourceName) : Optional.empty();

Review comment:
       Consider using `Optional.map` here.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org