Skip to content

Commit

Permalink
fix: boolean enum getRandomEnum
Browse files Browse the repository at this point in the history
  • Loading branch information
cdk8s-zelda committed Dec 24, 2019
1 parent 2c83793 commit 2617b3c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/com/cdk8s/sculptor/enums/BooleanEnum.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.cdk8s.sculptor.enums;

import com.cdk8s.sculptor.util.RandomUtil;

import java.util.HashMap;
import java.util.Map;

Expand All @@ -25,6 +27,11 @@ public String getDescription() {
return description;
}

public static BooleanEnum getRandomEnum() {
BooleanEnum[] allEnums = values();
return allEnums[RandomUtil.nextInt(0, allEnums.length)];
}

public static BooleanEnum getEnumByCode(Integer code) {
if (null == code) {
return null;
Expand Down

0 comments on commit 2617b3c

Please sign in to comment.