rain
2024-05-09 74d0031c16c468fa82208dbcdde4fa3766a58eeb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.dji.sample.component.mqtt.model;
 
import com.dji.sample.manage.service.IRequestsConfigService;
import com.dji.sample.manage.service.impl.ConfigProductServiceImpl;
import lombok.Getter;
 
import java.util.Arrays;
import java.util.Optional;
 
/**
 * @author sean
 * @version 1.3
 * @date 2022/11/10
 */
@Getter
public enum ConfigScopeEnum {
 
    PRODUCT("product", ConfigProductServiceImpl.class);
 
    String scope;
 
    Class<? extends IRequestsConfigService> clazz;
 
    ConfigScopeEnum(String scope, Class<? extends IRequestsConfigService> clazz) {
        this.scope = scope;
        this.clazz = clazz;
    }
 
    public static Optional<ConfigScopeEnum> find(String scope) {
        return Arrays.stream(ConfigScopeEnum.values()).filter(scopeEnum -> scopeEnum.scope.equals(scope)).findAny();
    }
}