private static void addClass(final Set<Class<?>> stroomClasses, final Class<?> clazz, final Type type) {
        if (clazz.isArray()) {
            addClass(stroomClasses, clazz.getComponentType(), null);

        } else if (type != null && Map.class.isAssignableFrom(clazz)) {
            final ParameterizedType parameterizedType = (ParameterizedType) type;
            for (final Type arg : parameterizedType.getActualTypeArguments()) {
                addType(stroomClasses, arg);
            }

        } else if (type != null && Collection.class.isAssignableFrom(clazz)) {
            final ParameterizedType parameterizedType = (ParameterizedType) type;
            for (final Type arg : parameterizedType.getActualTypeArguments()) {
                addType(stroomClasses, arg);
            }

        } else if (clazz.getName().startsWith(PACKAGE_START)
                && !clazz.getName().contains("StroomDuration")) { // Non POJO
            // IF the class references sub classes then include those too.
            final JsonSubTypes jsonSubTypes = clazz.getAnnotation(JsonSubTypes.class);
            if (jsonSubTypes != null) {
                for (final JsonSubTypes.Type subType : jsonSubTypes.value()) {
                    final Class<?> subTypeClass = subType.value();
                    addClass(stroomClasses, subTypeClass, null);
                }
            }

            if (!stroomClasses.contains(clazz)) {
                stroomClasses.add(clazz);
                addFields(stroomClasses, clazz);
            }
        }
    }
Test that classes that will be subject to JSON serialisation have the full complement of JSON annotations.
stroom-app/src/test/java/stroom/importexport/TestJsonSerialisation.java