From 60bc9218d0872e40a6857706d51955ee3d058717 Mon Sep 17 00:00:00 2001 From: Carlo Zancanaro Date: Wed, 10 Jun 2015 00:21:35 +1000 Subject: Support enums in the ObjectGeneration stuff --- .../java/au/id/zancanaro/javacheck/object/GeneratorProvider.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/main/java') 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) { -- cgit v1.2.3