Skip to content

Commit

Permalink
chore: replace @nullable with @checkfornull
Browse files Browse the repository at this point in the history
  • Loading branch information
jbee committed Nov 28, 2023
1 parent 26aa27b commit 5c2d3d0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
15 changes: 7 additions & 8 deletions src/main/java/org/hisp/dhis/rules/RuleEngineContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -52,19 +51,19 @@ public static class Builder
{
private RuleEngineIntent intent;

@Nullable
@CheckForNull
private List<Rule> rules;

@Nullable
@CheckForNull
private List<RuleVariable> ruleVariables;

@Nullable
@CheckForNull
private Map<String, List<String>> supplementaryData;

@Nullable
@CheckForNull
private Map<String, String> constantsValues;

@Nullable
@CheckForNull
private Map<String, DataItem> itemStore;

Builder( @Nonnull RuleExpressionEvaluator evaluator )
Expand Down Expand Up @@ -100,14 +99,14 @@ public Builder ruleVariables( List<RuleVariable> ruleVariables )
}

@Nonnull
public Builder ruleEngineItent( @Nullable RuleEngineIntent ruleEngineIntent )
public Builder ruleEngineItent( @CheckForNull RuleEngineIntent ruleEngineIntent )
{
this.intent = ruleEngineIntent;
return this;
}

@Nonnull
public Builder itemStore( @Nullable Map<String, DataItem> itemStore )
public Builder itemStore( @CheckForNull Map<String, DataItem> itemStore )
{
this.itemStore = itemStore;
return this;
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/hisp/dhis/rules/RuleVariableValue.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
import org.hisp.dhis.lib.expression.spi.VariableValue;
import org.hisp.dhis.rules.models.RuleValueType;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

public record RuleVariableValue(
@Nullable
@CheckForNull
String value,
@Nonnull
RuleValueType type,
@Nonnull
List<String> candidates,
@Nullable
@CheckForNull
String eventDate
) implements VariableValue {
private static final String DATE_PATTERN = "yyyy-MM-dd";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
import org.hisp.dhis.rules.models.TriggerEnvironment;
import org.hisp.dhis.rules.utils.RuleEngineUtils;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
Expand Down Expand Up @@ -39,13 +39,13 @@ public final class RuleVariableValueMapBuilder
@Nonnull
private final List<RuleEvent> ruleEvents;

@Nullable
@CheckForNull
public RuleEnrollment ruleEnrollment;

@Nullable
@CheckForNull
public RuleEvent ruleEvent;

@Nullable
@CheckForNull
private TriggerEnvironment triggerEnvironment;

private RuleVariableValueMapBuilder()
Expand Down Expand Up @@ -100,7 +100,7 @@ RuleVariableValueMapBuilder ruleVariables( @Nonnull List<RuleVariable> ruleVaria
}

@Nonnull
RuleVariableValueMapBuilder ruleEnrollment( @Nullable RuleEnrollment ruleEnrollment )
RuleVariableValueMapBuilder ruleEnrollment( @CheckForNull RuleEnrollment ruleEnrollment )
{
if ( this.ruleEnrollment != null )
{
Expand All @@ -113,7 +113,7 @@ RuleVariableValueMapBuilder ruleEnrollment( @Nullable RuleEnrollment ruleEnrollm
}

@Nonnull
RuleVariableValueMapBuilder triggerEnvironment( @Nullable TriggerEnvironment triggerEnvironment )
RuleVariableValueMapBuilder triggerEnvironment( @CheckForNull TriggerEnvironment triggerEnvironment )
{
if ( this.triggerEnvironment != null )
{
Expand Down Expand Up @@ -182,7 +182,7 @@ RuleVariableValueMap multipleBuild()
}

private boolean isEventInList( @Nonnull List<RuleEvent> ruleEvents,
@Nullable RuleEvent ruleEvent )
@CheckForNull RuleEvent ruleEvent )
{
if ( ruleEvent != null )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import org.hisp.dhis.rules.models.RuleValueType;

import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

import static org.junit.Assert.assertEquals;

Expand All @@ -23,7 +23,7 @@ static RuleVariableValueAssert assertThatVariable( @Nonnull RuleVariableValue va
}

@Nonnull
RuleVariableValueAssert hasValue( @Nullable String value )
RuleVariableValueAssert hasValue( @CheckForNull String value )
{
assertEquals( value , variableValue.value() );
return this;
Expand Down

0 comments on commit 5c2d3d0

Please sign in to comment.