diff options
author | Carlo Zancanaro <carlo@zancanaro.id.au> | 2015-06-10 00:21:35 +1000 |
---|---|---|
committer | Carlo Zancanaro <carlo@zancanaro.id.au> | 2015-06-10 00:21:35 +1000 |
commit | 60bc9218d0872e40a6857706d51955ee3d058717 (patch) | |
tree | b6032a73a629ffe6027dda34433d4ea972e5537f /src/main/java | |
parent | 6546881559e4bbcfe2b220199a9f3cd4196d1960 (diff) |
Support enums in the ObjectGeneration stuff
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/au/id/zancanaro/javacheck/object/GeneratorProvider.java | 7 |
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) { |