Skip to content

Spring Parser. Allow custom "Unwrapping" #345

@Antibrumm

Description

@Antibrumm

Hi

It would be nice to be able to have the possibility to unwrap a class type before giving it into the TypeProcessor handling.

I saw, for example, that you already handle ResponseEntity in the SpringApplicationParser explicitly and would need this feature to be available from outside so we can inject our own unwrapping.

A concrete use case would be my jackson filter library where the returnType is a generic class with the concrete result defined in the generic part:
(https://github.com/Antibrumm/jackson-antpathfilter)

    @RequestMapping
    @ResponseBody
    public AntPathFilterMappingJacksonValue<SomeClass> getSomeObject() {
        return new AntPathFilterMappingJacksonValue<>(someObject, "*", "*.*", "!not.that.path");
    }

Similar to ResponseEntity I would need to give the class SomeClass into the modelReturnType.

            final Class<?> returnType = method.getReturnType();
            final Type genericReturnType = method.getGenericReturnType();
            final Type modelReturnType = unwrapReturnType(genericReturnType);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions