-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allowing clients to pass an empty list of children to assign #5
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide fixes for the 3 comments and I will approve this pull request.
Thank you!
@@ -203,10 +203,15 @@ public void instantiateChild(RestObject restObj, RestObject childRestObj, RestOb | |||
|
|||
@Override | |||
public void assign(RestObject restObj, List<? extends RestObject> childRestObjs) throws RestException { | |||
restObj.assign(this, childRestObjs); | |||
assign(restObj, childRestObjs, null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency, this line should read: restObj.assign(this, childRestObjs) or restObj.assign(this, childRestObjs, null);
|
||
void assign(List<? extends RestObject> childRestObjs, boolean commit) throws RestException; | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove extra spaces. Fairly minor :-)
@@ -53,9 +53,11 @@ | |||
void instantiateChild(RestObject childRestObj, RestObject fromTemplate, Integer responseChoice, boolean commit) throws RestException; | |||
|
|||
void assign(List<? extends RestObject> childRestObjs) throws RestException; | |||
|
|||
void assign(List<? extends RestObject> childRestObjs, Class<? extends RestObject> objectType) throws RestException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
restObj.assign(this, childRestObjs, objectType); | ||
} | ||
|
||
@Override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
} else { | ||
throw new RestException("Session not available in current thread"); | ||
} | ||
} | ||
|
||
@Override | ||
public void assign(List<? extends RestObject> childRestObjs) throws RestException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
RestSession<?> session = RestSession.getCurrentSession(); | ||
if (session != null) { | ||
session.assign(this, childRestObjs); | ||
session.assign(this, childRestObjs, objectType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
@@ -212,16 +212,21 @@ public void instantiateChild(RestObject childRestObj, RestObject fromTemplate, I | |||
} | |||
|
|||
@Override | |||
public void assign(List<? extends RestObject> childRestObjs) throws RestException { | |||
public void assign(List<? extends RestObject> childRestObjs, Class<? extends RestObject> objectType) throws RestException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For API backwards compatibility, the following method signature should still be supported:
public void assign(List<? extends RestObject> childRestObjs) throws RestException
|
||
@Override | ||
public void assign(RestSession<?> session, List<? extends RestObject> childRestObjs, Class<? extends RestObject> objectType) throws RestException { | ||
assign(session, childRestObjs, objectType, true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
|
||
void assign(RestSession<?> session, List<? extends RestObject> childRestObjs, Class<? extends RestObject> objectType, boolean commit) throws RestException; | ||
|
||
void assign(RestSession<?> session, List<? extends RestObject> childRestObjs, Class<? extends RestObject> objectType) throws RestException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
@@ -59,6 +59,8 @@ | |||
void assign(RestObject restObj, List<? extends RestObject> childRestObjs) throws RestException; | |||
|
|||
void assign(RestObject restObj, List<? extends RestObject> childRestObjs, boolean commit) throws RestException; | |||
|
|||
void assign(RestObject restObj, List<? extends RestObject> childRestObjs, Class<? extends RestObject> objectType) throws RestException; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok
Fix for #4