
com.amazonaws.services.apigateway.model.PatchOperation Maven / Gradle / Ivy
Show all versions of aws-java-sdk-osgi Show documentation
/*
* Copyright 2011-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not
* use this file except in compliance with the License. A copy of the License is
* located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.amazonaws.services.apigateway.model;
import java.io.Serializable;
/**
* A single patch operation to apply to the specified resource. Please refer to
* http://tools.ietf.org/html/rfc6902#section-4 for an explanation of how each
* operation is used.
*/
public class PatchOperation implements Serializable, Cloneable {
/**
*
* A patch operation whose value indicates the operation to perform. Its
* value MUST be one of "add", "remove", "replace", "move", "copy", or
* "test"; other values are errors.
*
*/
private String op;
/**
*
* Operation objects MUST have exactly one "path" member. That member's
* value is a string containing a `JSON-Pointer` value that references a
* location within the target document (the "target location") where the
* operation is performed.
*
*/
private String path;
/**
*
* The actual value content.
*
*/
private String value;
/**
*
* The "move" and "copy" operation object MUST contain a "from" member,
* which is a string containing a JSON Pointer
value that
* references the location in the target document to move the value from.
*
*/
private String from;
/**
*
* A patch operation whose value indicates the operation to perform. Its
* value MUST be one of "add", "remove", "replace", "move", "copy", or
* "test"; other values are errors.
*
*
* @param op
* A patch operation whose value indicates the operation to perform.
* Its value MUST be one of "add", "remove", "replace", "move",
* "copy", or "test"; other values are errors.
* @see Op
*/
public void setOp(String op) {
this.op = op;
}
/**
*
* A patch operation whose value indicates the operation to perform. Its
* value MUST be one of "add", "remove", "replace", "move", "copy", or
* "test"; other values are errors.
*
*
* @return A patch operation whose value indicates the operation to perform.
* Its value MUST be one of "add", "remove", "replace", "move",
* "copy", or "test"; other values are errors.
* @see Op
*/
public String getOp() {
return this.op;
}
/**
*
* A patch operation whose value indicates the operation to perform. Its
* value MUST be one of "add", "remove", "replace", "move", "copy", or
* "test"; other values are errors.
*
*
* @param op
* A patch operation whose value indicates the operation to perform.
* Its value MUST be one of "add", "remove", "replace", "move",
* "copy", or "test"; other values are errors.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see Op
*/
public PatchOperation withOp(String op) {
setOp(op);
return this;
}
/**
*
* A patch operation whose value indicates the operation to perform. Its
* value MUST be one of "add", "remove", "replace", "move", "copy", or
* "test"; other values are errors.
*
*
* @param op
* A patch operation whose value indicates the operation to perform.
* Its value MUST be one of "add", "remove", "replace", "move",
* "copy", or "test"; other values are errors.
* @see Op
*/
public void setOp(Op op) {
this.op = op.toString();
}
/**
*
* A patch operation whose value indicates the operation to perform. Its
* value MUST be one of "add", "remove", "replace", "move", "copy", or
* "test"; other values are errors.
*
*
* @param op
* A patch operation whose value indicates the operation to perform.
* Its value MUST be one of "add", "remove", "replace", "move",
* "copy", or "test"; other values are errors.
* @return Returns a reference to this object so that method calls can be
* chained together.
* @see Op
*/
public PatchOperation withOp(Op op) {
setOp(op);
return this;
}
/**
*
* Operation objects MUST have exactly one "path" member. That member's
* value is a string containing a `JSON-Pointer` value that references a
* location within the target document (the "target location") where the
* operation is performed.
*
*
* @param path
* Operation objects MUST have exactly one "path" member. That
* member's value is a string containing a `JSON-Pointer` value that
* references a location within the target document (the
* "target location") where the operation is performed.
*/
public void setPath(String path) {
this.path = path;
}
/**
*
* Operation objects MUST have exactly one "path" member. That member's
* value is a string containing a `JSON-Pointer` value that references a
* location within the target document (the "target location") where the
* operation is performed.
*
*
* @return Operation objects MUST have exactly one "path" member. That
* member's value is a string containing a `JSON-Pointer` value that
* references a location within the target document (the
* "target location") where the operation is performed.
*/
public String getPath() {
return this.path;
}
/**
*
* Operation objects MUST have exactly one "path" member. That member's
* value is a string containing a `JSON-Pointer` value that references a
* location within the target document (the "target location") where the
* operation is performed.
*
*
* @param path
* Operation objects MUST have exactly one "path" member. That
* member's value is a string containing a `JSON-Pointer` value that
* references a location within the target document (the
* "target location") where the operation is performed.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public PatchOperation withPath(String path) {
setPath(path);
return this;
}
/**
*
* The actual value content.
*
*
* @param value
* The actual value content.
*/
public void setValue(String value) {
this.value = value;
}
/**
*
* The actual value content.
*
*
* @return The actual value content.
*/
public String getValue() {
return this.value;
}
/**
*
* The actual value content.
*
*
* @param value
* The actual value content.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public PatchOperation withValue(String value) {
setValue(value);
return this;
}
/**
*
* The "move" and "copy" operation object MUST contain a "from" member,
* which is a string containing a JSON Pointer
value that
* references the location in the target document to move the value from.
*
*
* @param from
* The "move" and "copy" operation object MUST contain a "from"
* member, which is a string containing a JSON Pointer
* value that references the location in the target document to move
* the value from.
*/
public void setFrom(String from) {
this.from = from;
}
/**
*
* The "move" and "copy" operation object MUST contain a "from" member,
* which is a string containing a JSON Pointer
value that
* references the location in the target document to move the value from.
*
*
* @return The "move" and "copy" operation object MUST contain a "from"
* member, which is a string containing a JSON Pointer
* value that references the location in the target document to move
* the value from.
*/
public String getFrom() {
return this.from;
}
/**
*
* The "move" and "copy" operation object MUST contain a "from" member,
* which is a string containing a JSON Pointer
value that
* references the location in the target document to move the value from.
*
*
* @param from
* The "move" and "copy" operation object MUST contain a "from"
* member, which is a string containing a JSON Pointer
* value that references the location in the target document to move
* the value from.
* @return Returns a reference to this object so that method calls can be
* chained together.
*/
public PatchOperation withFrom(String from) {
setFrom(from);
return this;
}
/**
* Returns a string representation of this object; useful for testing and
* debugging.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getOp() != null)
sb.append("Op: " + getOp() + ",");
if (getPath() != null)
sb.append("Path: " + getPath() + ",");
if (getValue() != null)
sb.append("Value: " + getValue() + ",");
if (getFrom() != null)
sb.append("From: " + getFrom());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof PatchOperation == false)
return false;
PatchOperation other = (PatchOperation) obj;
if (other.getOp() == null ^ this.getOp() == null)
return false;
if (other.getOp() != null
&& other.getOp().equals(this.getOp()) == false)
return false;
if (other.getPath() == null ^ this.getPath() == null)
return false;
if (other.getPath() != null
&& other.getPath().equals(this.getPath()) == false)
return false;
if (other.getValue() == null ^ this.getValue() == null)
return false;
if (other.getValue() != null
&& other.getValue().equals(this.getValue()) == false)
return false;
if (other.getFrom() == null ^ this.getFrom() == null)
return false;
if (other.getFrom() != null
&& other.getFrom().equals(this.getFrom()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode
+ ((getOp() == null) ? 0 : getOp().hashCode());
hashCode = prime * hashCode
+ ((getPath() == null) ? 0 : getPath().hashCode());
hashCode = prime * hashCode
+ ((getValue() == null) ? 0 : getValue().hashCode());
hashCode = prime * hashCode
+ ((getFrom() == null) ? 0 : getFrom().hashCode());
return hashCode;
}
@Override
public PatchOperation clone() {
try {
return (PatchOperation) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(
"Got a CloneNotSupportedException from Object.clone() "
+ "even though we're Cloneable!", e);
}
}
}