掲示板

case for Fake Entity ?

thumbnail
6年前 に Jack Bakker によって更新されました。

case for Fake Entity ?

Liferay Master 投稿: 978 参加年月日: 10/01/03 最新の投稿
If I have a Category (in a Vocabulary) with properties (key/value). One property might be: key=MyKey value=MyValue. Let's say I want a beanLike "MyCategoryName" that has a method that returns "MyValue" like:

public String getMyKey(){
...
}

Would use of a Fake Entity be a good fit for this need ? (changing category property "keyName" would break this, yeah).

And a good fit, then what about doing something similar for entities with many custom fields... like MyOrganizationOnExpandoSteroids ?

A goal here is that the remote service on the fake entity could then could provide the json
thumbnail
6年前 に David H Nebinger によって更新されました。

RE: case for Fake Entity ?

Liferay Legend 投稿: 14919 参加年月日: 06/09/02 最新の投稿
I think it would be a use case...

I don't believe expandos are ever included in the JSON reply, so it would be a way to include additional fields to effectively "flatten" the hierarchy.

But I think you could also make the argument that using the simpler JSON annotations to use your own DTO mechanism.

But me? I'd probably go with the fake entity approach. It might seem "change resistant", but personally I like that SB generates all of that boilerplate code so I don't have to worry about it. But I can understand where others might prefer the "lighter" touch...






Come meet me at Devcon 2017 or 2017 LSNA!