Skip to content

Conversation

@shubham1g5
Copy link
Contributor

@shubham1g5 shubham1g5 commented Feb 27, 2019

Refactoring to support root atrributes lookup for Android indexed fixture.

  • Adds IndexedFixtureIdentifier to hold basic/meta properties for an indexed fixture.
  • Modifies IndexedFixtureInstanceTreeElement to have hold attributes in TreeElement attrHolder
  • Refactors T getAttribute(String namespace, String name) to AbstractTreeElement getAttribute(String namespace, String name) to be able to return last_sync as an instance of AbstractTreeElement rather than IndexedFixtureChildElement. It's possible that it's not the right soultion here but I could not think of any alternates.

cross-request: dimagi/commcare-android#2085

@Override
public AbstractTreeElement getAttribute(String namespace, String name) {
TreeElement attr = attrHolder.getAttribute(namespace, name);
attr.setParent(this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you confirm that this method has no side effects that affect the current object (this)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only affect is that invalidates the reference cache for this. Is this something to be worried about ?

Copy link
Member

@ctsims ctsims Apr 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, invalidating the reference cache is fine, I just wanted to make sure that this wouldn't result in a "Backlink" being created where "this" (the treelement part of the object) now has an independent reference to attr

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

got it. Doesn't look like that's happening.

@shubham1g5 shubham1g5 merged commit 4085b81 into master Apr 29, 2019
@shubham1g5 shubham1g5 deleted the last_sync_support branch April 29, 2019 04:50
@shubham1g5 shubham1g5 added this to the 2.46 milestone May 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants