-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat: add base model response and builder #4
- Loading branch information
1 parent
665d209
commit de51dff
Showing
8 changed files
with
380 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
plugin/src/main/groovy/org/unify4j/model/builder/VerificationBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.unify4j.model.builder; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import org.unify4j.model.response.VerificationResponse; | ||
|
||
import java.io.Serializable; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class VerificationBuilder implements Serializable { | ||
public VerificationBuilder() { | ||
super(); | ||
} | ||
|
||
private String object; | ||
private String field; | ||
private Object rejectedValue; | ||
private String message; | ||
|
||
public VerificationBuilder setObject(String object) { | ||
this.object = object; | ||
return this; | ||
} | ||
|
||
public VerificationBuilder setField(String field) { | ||
this.field = field; | ||
return this; | ||
} | ||
|
||
public VerificationBuilder setRejectedValue(Object rejectedValue) { | ||
this.rejectedValue = rejectedValue; | ||
return this; | ||
} | ||
|
||
public VerificationBuilder setMessage(String message) { | ||
this.message = message; | ||
return this; | ||
} | ||
|
||
public VerificationResponse build() { | ||
VerificationResponse e = new VerificationResponse(); | ||
e.setObject(this.object); | ||
e.setField(this.field); | ||
e.setRejectedValue(this.rejectedValue); | ||
e.setMessage(this.message); | ||
return e; | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
plugin/src/main/groovy/org/unify4j/model/builder/VerificationOutlineBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package org.unify4j.model.builder; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import org.unify4j.model.response.VerificationOutlineResponse; | ||
|
||
import java.io.Serializable; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class VerificationOutlineBuilder implements Serializable { | ||
public VerificationOutlineBuilder() { | ||
super(); | ||
} | ||
|
||
private String object; | ||
private String field; | ||
private Object rejectedValue; | ||
private String message; | ||
|
||
public VerificationOutlineBuilder setObject(String object) { | ||
this.object = object; | ||
return this; | ||
} | ||
|
||
public VerificationOutlineBuilder setField(String field) { | ||
this.field = field; | ||
return this; | ||
} | ||
|
||
public VerificationOutlineBuilder setRejectedValue(Object rejectedValue) { | ||
this.rejectedValue = rejectedValue; | ||
return this; | ||
} | ||
|
||
public VerificationOutlineBuilder setMessage(String message) { | ||
this.message = message; | ||
return this; | ||
} | ||
|
||
public VerificationOutlineResponse build() { | ||
VerificationOutlineResponse e = new VerificationOutlineResponse(); | ||
e.setObject(this.object); | ||
e.setField(this.field); | ||
e.setRejectedValue(this.rejectedValue); | ||
e.setMessage(this.message); | ||
return e; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
plugin/src/main/groovy/org/unify4j/model/response/BaseOutlineResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package org.unify4j.model.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public abstract class BaseOutlineResponse { | ||
} |
72 changes: 72 additions & 0 deletions
72
plugin/src/main/groovy/org/unify4j/model/response/VerificationOutlineResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package org.unify4j.model.response; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import org.unify4j.common.Json4j; | ||
|
||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public class VerificationOutlineResponse extends BaseOutlineResponse { | ||
public VerificationOutlineResponse() { | ||
super(); | ||
} | ||
|
||
public VerificationOutlineResponse(String object, String message) { | ||
super(); | ||
this.object = object; | ||
this.message = message; | ||
} | ||
|
||
public VerificationOutlineResponse(String object, String field, Object rejectedValue, String message) { | ||
super(); | ||
this.object = object; | ||
this.field = field; | ||
this.rejectedValue = rejectedValue; | ||
this.message = message; | ||
} | ||
|
||
private String object; | ||
private String field; | ||
private Object rejectedValue; | ||
private String message; | ||
|
||
public String getObject() { | ||
return object; | ||
} | ||
|
||
public void setObject(String object) { | ||
this.object = object; | ||
} | ||
|
||
public String getField() { | ||
return field; | ||
} | ||
|
||
public void setField(String field) { | ||
this.field = field; | ||
} | ||
|
||
public Object getRejectedValue() { | ||
return rejectedValue; | ||
} | ||
|
||
public void setRejectedValue(Object rejectedValue) { | ||
this.rejectedValue = rejectedValue; | ||
} | ||
|
||
public String getMessage() { | ||
return message; | ||
} | ||
|
||
public void setMessage(String message) { | ||
this.message = message; | ||
} | ||
|
||
public static String getForms(VerificationOutlineResponse verification) { | ||
return String.format("%s: %s", verification.getField(), verification.getMessage()); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return String.format("Verification outline response { object: %s, field: %s, rejected_value: %s, message: %s }", | ||
object, field, Json4j.toJson(rejectedValue), message); | ||
} | ||
} |
Oops, something went wrong.