Skip to content

Commit

Permalink
Moar validation.
Browse files Browse the repository at this point in the history
  • Loading branch information
DamonHD committed May 27, 2024
1 parent d0daaee commit f1d1a0e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions javasrc/org/hd/d/statsHouse/feedHits/data/FeedStatus.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
* <p>
* All integer values are non-negative, all Strings are non-null, cols is non-null.
* <p>
* The colTypes element count must match cols.
* <p>
* This makes an immutable copy of the cols data to ensure record immutability.
*/
public record FeedStatus(int hits, int bytes, String colTypes, List<Integer> cols, String index)
Expand All @@ -52,6 +54,7 @@ public record FeedStatus(int hits, int bytes, String colTypes, List<Integer> col
if(bytes < 0) { throw new IllegalArgumentException(); }
Objects.nonNull(colTypes);
Objects.nonNull(cols);
for(final int c : cols) { if(c < 0) { throw new IllegalArgumentException(); } }
Objects.nonNull(index);
if(cols.size() != colTypes.split(":").length) { throw new IllegalArgumentException("colTypes element count must match cols"); }
}
Expand Down

0 comments on commit f1d1a0e

Please sign in to comment.