contentful / contentful.java

Java SDK for Contentful's Content Delivery API
https://contentful.github.io/contentful.java/
Apache License 2.0
74 stars 49 forks source link

Need to access TransformQuery.transform(CDAEntry entry) #260

Closed jmfayard closed 2 years ago

jmfayard commented 2 years ago

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?

rafalniski commented 2 years ago

Hey @jmfayard , unfortunately, we don't have plans to make it a public API any time soon.