Mark fields final where appropriate

pull/284/head
Mahmoud Ben Hassine 5 years ago
parent 6cc0823df4
commit 0060357466
No known key found for this signature in database
GPG Key ID: 79FCFB0A184E0036

@ -32,9 +32,9 @@ import java.lang.reflect.Method;
*/
class ActionMethodOrderBean implements Comparable<ActionMethodOrderBean> {
private Method method;
private final Method method;
private int order;
private final int order;
ActionMethodOrderBean(final Method method, final int order) {
this.method = method;

@ -27,13 +27,12 @@ import org.jeasy.rules.api.Action;
import org.jeasy.rules.api.Condition;
import org.jeasy.rules.api.Facts;
import java.util.ArrayList;
import java.util.List;
class DefaultRule extends BasicRule {
private Condition condition = Condition.FALSE;
private List<Action> actions = new ArrayList<>();
private final Condition condition;
private final List<Action> actions;
DefaultRule(String name, String description, int priority, Condition condition, List<Action> actions) {
super(name, description, priority);

@ -42,7 +42,7 @@ public final class InferenceRulesEngine extends AbstractRulesEngine {
private static final Logger LOGGER = LoggerFactory.getLogger(InferenceRulesEngine.class);
private DefaultRulesEngine delegate;
private final DefaultRulesEngine delegate;
/**
* Create a new inference rules engine with default parameters.

@ -25,7 +25,7 @@ package org.jeasy.rules.core;
class NoSuchFactException extends RuntimeException {
private String missingFact;
private final String missingFact;
public NoSuchFactException(String message, String missingFact) {
super(message);

@ -42,7 +42,7 @@ public class RuleBuilder {
private int priority = Rule.DEFAULT_PRIORITY;
private Condition condition = Condition.FALSE;
private List<Action> actions = new ArrayList<>();
private final List<Action> actions = new ArrayList<>();
/**
* Set rule name.

@ -48,7 +48,7 @@ import static java.lang.String.format;
*/
public class RuleProxy implements InvocationHandler {
private Object target;
private final Object target;
private String name;
private String description;
private Integer priority;
@ -59,7 +59,7 @@ public class RuleProxy implements InvocationHandler {
private Method toStringMethod;
private org.jeasy.rules.annotation.Rule annotation;
private static RuleDefinitionValidator ruleDefinitionValidator = new RuleDefinitionValidator();
private static final RuleDefinitionValidator ruleDefinitionValidator = new RuleDefinitionValidator();
private static final Logger LOGGER = LoggerFactory.getLogger(RuleProxy.class);

@ -41,8 +41,8 @@ public class MVELAction implements Action {
private static final Logger LOGGER = LoggerFactory.getLogger(MVELAction.class);
private String expression;
private Serializable compiledExpression;
private final String expression;
private final Serializable compiledExpression;
/**
* Create a new {@link MVELAction}.

@ -37,7 +37,7 @@ import java.io.Serializable;
*/
public class MVELCondition implements Condition {
private Serializable compiledExpression;
private final Serializable compiledExpression;
/**
* Create a new {@link MVELCondition}.

@ -41,7 +41,7 @@ import java.util.List;
public class MVELRule extends BasicRule {
private Condition condition = Condition.FALSE;
private List<Action> actions = new ArrayList<>();
private final List<Action> actions = new ArrayList<>();
private final ParserContext parserContext;
/**

@ -43,7 +43,7 @@ import java.util.List;
public class SpELRule extends BasicRule {
private Condition condition = Condition.FALSE;
private List<Action> actions = new ArrayList<>();
private final List<Action> actions = new ArrayList<>();
private final ParserContext parserContext;
private BeanResolver beanResolver;

@ -45,7 +45,7 @@ public abstract class CompositeRule extends BasicRule {
*/
protected Set<Rule> rules;
private Map<Object, Rule> proxyRules;
private final Map<Object, Rule> proxyRules;
/**
* Create a new {@link CompositeRule}.

@ -44,7 +44,7 @@ import java.util.Map;
@SuppressWarnings("unchecked")
public class JsonRuleDefinitionReader extends AbstractRuleDefinitionReader {
private ObjectMapper objectMapper;
private final ObjectMapper objectMapper;
/**
* Create a new {@link JsonRuleDefinitionReader}.

@ -46,7 +46,7 @@ import java.util.Map;
@SuppressWarnings("unchecked")
public class YamlRuleDefinitionReader extends AbstractRuleDefinitionReader {
private Yaml yaml;
private final Yaml yaml;
/**
* Create a new {@link YamlRuleDefinitionReader}.

Loading…
Cancel
Save