contentful.java icon indicating copy to clipboard operation
contentful.java copied to clipboard

Need to access TransformQuery.transform(CDAEntry entry)

Open jmfayard opened this issue 3 years ago • 0 comments

Bonjour,

In our codebase, we have some boring manual mapping functions like this one:

fun mapCDAEntryToEmployee(entry: CDAEntry): Employee {
    return Employee(
        id = entry.id(),
        firstName = entry.getField("firstName") ?: String.EMPTY,
        lastName = entry.getField("lastName") ?: String.EMPTY,
/// ...
    )
}

That's because we need to call that outside of a TransformQuery

And TransformQuery seems to be the only place where mapping from a CDAEntry to a POJO via annotations is available https://github.com/contentful/contentful.java/blob/05a333376279ae972433ae2e862c013560d39d0e/src/main/java/com/contentful/java/cda/TransformQuery.java#L349-L465

Would it be possible to add a public API for that?

jmfayard avatar Jun 29 '22 10:06 jmfayard