summaryrefslogtreecommitdiff
path: root/src/main/java/au/id/zancanaro
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/au/id/zancanaro')
-rw-r--r--src/main/java/au/id/zancanaro/javacheck/object/GeneratorProvider.java7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/main/java/au/id/zancanaro/javacheck/object/GeneratorProvider.java b/src/main/java/au/id/zancanaro/javacheck/object/GeneratorProvider.java
index 24b73d5..827ba3f 100644
--- a/src/main/java/au/id/zancanaro/javacheck/object/GeneratorProvider.java
+++ b/src/main/java/au/id/zancanaro/javacheck/object/GeneratorProvider.java
@@ -88,7 +88,12 @@ public interface GeneratorProvider {
provider.getGenerator(keyType, new Annotation[0], provider),
provider.getGenerator(valueType, new Annotation[0], provider));
} else if (type instanceof Class) {
- return ofType((Class<?>) type, provider);
+ Class<?> clazz = (Class<?>) type;
+ if (Enum.class.isAssignableFrom(clazz)) {
+ return elements(clazz.getEnumConstants());
+ } else {
+ return ofType((Class<?>) type, provider);
+ }
} else if (type instanceof ParameterizedType) {
ParameterizedType param = (ParameterizedType) type;
if (param.getRawType() instanceof Class) {