|
| 1 | +package org.databunker.options; |
| 2 | + |
| 3 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 4 | + |
| 5 | +/** |
| 6 | + * Represents a patch operation for updating user data |
| 7 | + */ |
| 8 | +public class PatchOperation { |
| 9 | + @JsonProperty("op") |
| 10 | + private String op; |
| 11 | + |
| 12 | + @JsonProperty("path") |
| 13 | + private String path; |
| 14 | + |
| 15 | + @JsonProperty("value") |
| 16 | + private Object value; |
| 17 | + |
| 18 | + /** |
| 19 | + * Default constructor |
| 20 | + */ |
| 21 | + public PatchOperation() { |
| 22 | + } |
| 23 | + |
| 24 | + /** |
| 25 | + * Constructor with all fields |
| 26 | + * |
| 27 | + * @param op Operation type (e.g., 'add', 'replace', 'remove') |
| 28 | + * @param path JSON path to the field to modify |
| 29 | + * @param value New value for the field |
| 30 | + */ |
| 31 | + public PatchOperation(String op, String path, Object value) { |
| 32 | + this.op = op; |
| 33 | + this.path = path; |
| 34 | + this.value = value; |
| 35 | + } |
| 36 | + |
| 37 | + /** |
| 38 | + * Gets the operation type |
| 39 | + * |
| 40 | + * @return The operation type (e.g., 'add', 'replace', 'remove') |
| 41 | + */ |
| 42 | + public String getOp() { |
| 43 | + return op; |
| 44 | + } |
| 45 | + |
| 46 | + /** |
| 47 | + * Sets the operation type |
| 48 | + * |
| 49 | + * @param op The operation type (e.g., 'add', 'replace', 'remove') |
| 50 | + */ |
| 51 | + public void setOp(String op) { |
| 52 | + this.op = op; |
| 53 | + } |
| 54 | + |
| 55 | + /** |
| 56 | + * Gets the JSON path to the field to modify |
| 57 | + * |
| 58 | + * @return The JSON path |
| 59 | + */ |
| 60 | + public String getPath() { |
| 61 | + return path; |
| 62 | + } |
| 63 | + |
| 64 | + /** |
| 65 | + * Sets the JSON path to the field to modify |
| 66 | + * |
| 67 | + * @param path The JSON path |
| 68 | + */ |
| 69 | + public void setPath(String path) { |
| 70 | + this.path = path; |
| 71 | + } |
| 72 | + |
| 73 | + /** |
| 74 | + * Gets the new value for the field |
| 75 | + * |
| 76 | + * @return The new value |
| 77 | + */ |
| 78 | + public Object getValue() { |
| 79 | + return value; |
| 80 | + } |
| 81 | + |
| 82 | + /** |
| 83 | + * Sets the new value for the field |
| 84 | + * |
| 85 | + * @param value The new value |
| 86 | + */ |
| 87 | + public void setValue(Object value) { |
| 88 | + this.value = value; |
| 89 | + } |
| 90 | +} |
0 commit comments