class DTOUtil {
    private DTOUtil() {
        // private to ensure static
    }

    // ModelMapper is thread-safe and we only need to convert different object types for now
    // so it should be safe to reuse its instance.
    private static final ModelMapper modelMapper = new ModelMapper();

    /**
     * Generate Data Transfer Object from an object. Any field in the input object
     * that is annotated with <code>DTOElement</code> will be brought along.
     * @param object object to use as input
     * @return DTO with values and generated getters/setters from input object
     */
    public static Object createDTO(Object object) {<FILL_FUNCTION_BODY>}
}

        // ModelMapper assumes getters/setters so use BeanGenerator to provide them.
        BeanGenerator beanGenerator = new BeanGenerator();
        for (Field field : object.getClass().getDeclaredFields()) {
            if (field.isAnnotationPresent(DTOElement.class)) {
                beanGenerator.addProperty(field.getName(), field.getType());
            }
        }
        Object bean = beanGenerator.create();

        return modelMapper.map(object, bean.getClass());
    
<no_super_class>