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 2020/10/12 12:03:56 UTC

[GitHub] [shardingsphere-elasticjob] TeslaCN commented on a change in pull request #1552: Trim suffix of lambda class name when using lambda expression implementation of ElasticJob

TeslaCN commented on a change in pull request #1552:
URL: https://github.com/apache/shardingsphere-elasticjob/pull/1552#discussion_r503248310



##########
File path: elasticjob-lite/elasticjob-lite-core/src/main/java/org/apache/shardingsphere/elasticjob/lite/internal/setup/DefaultJobClassNameProvider.java
##########
@@ -22,10 +22,20 @@
 /**
  * Simple job class name provider.
  */
-public final class SimpleJobClassNameProvider implements JobClassNameProvider {
+public final class DefaultJobClassNameProvider implements JobClassNameProvider {
     
     @Override
     public String getJobClassName(final ElasticJob elasticJob) {
-        return elasticJob.getClass().getName();
+        Class<? extends ElasticJob> elasticJobClass = elasticJob.getClass();
+        String elasticJobClassName = elasticJobClass.getName();
+        return isLambdaClass(elasticJobClass) ? trimLambdaClassSuffix(elasticJobClassName) : elasticJobClassName;
+    }
+    
+    private boolean isLambdaClass(final Class<? extends ElasticJob> elasticJobClass) {

Review comment:
       Testcase will be committed in a new PR.




----------------------------------------------------------------
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.

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