Entity as an Effector parameter

3 views
Skip to first unread message

Zaid Mohsin

unread,
May 2, 2014, 12:28:08 PM5/2/14
to brooklyn-dev
Is it good practice to pass an object of type Entity to an Effector? Any examples in Brooklyn that does that? Same question applies for multiple arguments, e.g. (String, String, int).

Regards

signature.asc

Aled Sage

unread,
May 2, 2014, 1:42:38 PM5/2/14
to brookl...@googlegroups.com
Hi Zaid,

For effector-as-param, rule of thumb is whether you want to ever call it
from the web-console or REST api. If so, then better to take the entity
id and look that up.
But if it's just being called programmatically then you have the
parameter of type Entity.

Multiple arguments are absolutely fine.

Also note that args passed through the web-console / REST api will have
their types coerced using TypeCoercions.coerce so as well as the
standard strings/primitives you can have args of some complex types like
List, Map etc [1].

Aled

p.s. perhaps we should add a TypeCoercion for entity-id to Entity? Not
sure about that though.

[1]
https://github.com/brooklyncentral/brooklyn/blob/master/core/src/main/java/brooklyn/util/flags/TypeCoercions.java#L550-561

Zaid Mohsin

unread,
May 2, 2014, 1:44:02 PM5/2/14
to brookl...@googlegroups.com
Hi Aled,
I’ve used multiple params collected from the entity to send it over the Effector.

Regards
> --
> You received this message because you are subscribed to the Google Groups "brooklyn-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to brooklyn-dev...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

signature.asc
Reply all
Reply to author
Forward
0 new messages