Still in my plugin, I have a rule which has access...
# general
r
Still in my plugin, I have a rule which has access to a target. Inside there is a field named "policies". I can see the data if I logger.info(mytarget) but I can't access it. mytarget.policies or mytarget["policies"] don't work. How can I access that field?
f
Access is indexed based on the type of the field, not its name.
mytarget.get(MyPoliciesField)
-- if the type of
policies
field was
MyPoliciesField
-- see https://www.pantsbuild.org/docs/target-api-concepts#a-field-driven-api
the name of the field as exposed in
BUILD
files becomes somewhat irrelevant to plugin code trying to access those fields.
r
ok, thanks!