Skip to content

Commit

Permalink
feat: common base interface for responses
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Jose committed Dec 5, 2022
1 parent 29f2985 commit fcb4fab
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
7 changes: 7 additions & 0 deletions src/main/java/com/wayfair/javafroid/model/BaseResponse.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.wayfair.javafroid.model;

import java.util.List;

public interface BaseResponse {
List<Error> getErrors();
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.ArrayList;
import java.util.List;

public class EntitiesResponse {
public class EntitiesResponse implements BaseResponse {

private EntityList data;
private List<Error> errors;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@
import java.util.List;
import java.util.Map;

public class EntityObjectResponse {
public class EntityObjectResponse implements BaseResponse {
private Map<String, Object> data;
private List<Error> error;
private List<Error> errors;
private Map<String, Object> extensions;

public EntityObjectResponse() {
}

public EntityObjectResponse(Map<String, Object> data, List<Error> error, Map<String, Object> extensions) {
public EntityObjectResponse(Map<String, Object> data, List<Error> errors, Map<String, Object> extensions) {
this.data = data;
this.error = error;
this.errors = errors;
this.extensions = extensions;
}

public Map<String, Object> getData() {
return data;
}

public List<Error> getError() {
return error;
public List<Error> getErrors() {
return errors;
}

public Map<String, Object> getExtensions() {
Expand All @@ -33,8 +33,8 @@ public void setData(Map<String, Object> data) {
this.data = data;
}

public void setError(List<Error> error) {
this.error = error;
public void setErrors(List<Error> errors) {
this.errors = errors;
}

public void setExtensions(Map<String, Object> extensions) {
Expand Down

0 comments on commit fcb4fab

Please sign in to comment.