Skip to content

Commit

Permalink
permit empty values for conf. keys (Closes #148)
Browse files Browse the repository at this point in the history
  • Loading branch information
goekay committed Jun 21, 2019
1 parent 010f061 commit 547b877
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.Objects;

/**
* @author Sevket Goekay <goekay@dbis.rwth-aachen.de>
Expand All @@ -44,7 +45,8 @@ public class ChangeConfigurationParams extends MultipleChargePointSelect {
@NotNull(message = "Key type is required")
private ConfigurationKeyType keyType = ConfigurationKeyType.PREDEFINED;

@NotBlank(message = "Value is required")
// Disabled @NotBlank after https://github.com/RWTH-i5-IDSG/steve/issues/148
// @NotBlank(message = "Value is required")
@Pattern(regexp = "\\S+", message = "Value cannot contain any whitespace")
private String value;

Expand Down Expand Up @@ -77,6 +79,15 @@ public String getKey() {
throw new SteveException("Cannot determine key (KeyType in illegal state)");
}

/**
* Because we want to permit empty values
*
* https://github.com/RWTH-i5-IDSG/steve/issues/148
*/
public String getValue() {
return Objects.requireNonNullElse(value, "");
}

// -------------------------------------------------------------------------
// Enum
// -------------------------------------------------------------------------
Expand Down

0 comments on commit 547b877

Please sign in to comment.