All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jetlinks.rule.engine.api.model.Condition Maven / Gradle / Ivy

The newest version!
package org.jetlinks.rule.engine.api.model;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.util.Map;
import java.util.Optional;

/**
 * 规则条件
 *
 * @author zhouhao
 * @since 1.0.0
 */
@Getter
@Setter
public class Condition implements Serializable {

    private static final long serialVersionUID = -6849794470754667710L;

    /**
     * 条件类型,不同的条件类型支持不同的处理方式,由具体的规则引擎实现
     */
    private String type;

    /**
     * 条件配置,不同的条件类型配置不同
     */
    private Map configuration;

    @SuppressWarnings("all")
    public  Optional getConfig(String key) {
        return Optional
                .ofNullable(configuration)
                .map(cfg -> (T) cfg.get(key));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy