[YANGTOOLS-103] builder - copy contructor / fieldsFrom Created: 18/Mar/14  Updated: 10/Apr/22  Due: 18/Jul/14  Resolved: 21/Jul/14

Status: Resolved
Project: yangtools
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement
Reporter: Michal Rehak Assignee: Martin Vitez
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: Linux
Platform: PC


Issue Links:
Duplicate
is duplicated by YANGTOOLS-105 A copy constructor for builder of lis... Resolved

 Description   

In case we need to copy fields (via method or contructor) from DataObject of the same type, then the copy contructor and fieldsFrom method should copy key, id and augmentations (full deep copy).



 Comments   
Comment by Tony Tkacik [ 28/Mar/14 ]

From duplicate reported by Martin Sunal:

Builder which is generated for list and container yang statements should contain a copy constructor where parameter is type of build() method.
Example:

public class GroupBuilder {

public GroupBuilder(Group group) {
if (group instanceof GroupImpl)

{ GroupImpl groupImpl = (GroupImpl) group; // copy attributes here }

}

public Group build()

{ return new GroupImpl(this); }

}

Comment by Martin Vitez [ 16/Jul/14 ]

Proposed patch:

https://git.opendaylight.org/gerrit/#/c/9048/

Generated at Wed Feb 07 20:52:16 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.