Skip to content
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

Closed
wants to merge 2 commits into from

Conversation

emanoelxavier
Copy link

Fix for #4

Copy link
Contributor

@martin-leclerc martin-leclerc left a 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);
Copy link
Contributor

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;

Copy link
Contributor

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;
Copy link
Contributor

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
Copy link
Contributor

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 {
Copy link
Contributor

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);
Copy link
Contributor

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 {
Copy link
Contributor

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);
Copy link
Contributor

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;
Copy link
Contributor

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;
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants