![JAR search and dependency download from the Maven repository](/logo.png)
com.contrastsecurity.sarif.Node Maven / Gradle / Ivy
package com.contrastsecurity.sarif;
import java.util.LinkedHashSet;
import java.util.Set;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
/**
* Represents a node in a graph.
*
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"id",
"label",
"location",
"children",
"properties"
})
public class Node {
/**
* A string that uniquely identifies the node within its graph.
* (Required)
*
*/
@JsonProperty("id")
@JsonPropertyDescription("A string that uniquely identifies the node within its graph.")
private String id;
/**
* Encapsulates a message intended to be read by the end user.
*
*/
@JsonProperty("label")
@JsonPropertyDescription("Encapsulates a message intended to be read by the end user.")
private Message label;
/**
* A location within a programming artifact.
*
*/
@JsonProperty("location")
@JsonPropertyDescription("A location within a programming artifact.")
private Location location;
/**
* Array of child nodes.
*
*/
@JsonProperty("children")
@JsonDeserialize(as = java.util.LinkedHashSet.class)
@JsonPropertyDescription("Array of child nodes.")
private Set children = new LinkedHashSet();
/**
* Key/value pairs that provide additional information about the object.
*
*/
@JsonProperty("properties")
@JsonPropertyDescription("Key/value pairs that provide additional information about the object.")
private PropertyBag properties;
/**
* A string that uniquely identifies the node within its graph.
* (Required)
*
*/
@JsonProperty("id")
public String getId() {
return id;
}
/**
* A string that uniquely identifies the node within its graph.
* (Required)
*
*/
@JsonProperty("id")
public void setId(String id) {
this.id = id;
}
public Node withId(String id) {
this.id = id;
return this;
}
/**
* Encapsulates a message intended to be read by the end user.
*
*/
@JsonProperty("label")
public Message getLabel() {
return label;
}
/**
* Encapsulates a message intended to be read by the end user.
*
*/
@JsonProperty("label")
public void setLabel(Message label) {
this.label = label;
}
public Node withLabel(Message label) {
this.label = label;
return this;
}
/**
* A location within a programming artifact.
*
*/
@JsonProperty("location")
public Location getLocation() {
return location;
}
/**
* A location within a programming artifact.
*
*/
@JsonProperty("location")
public void setLocation(Location location) {
this.location = location;
}
public Node withLocation(Location location) {
this.location = location;
return this;
}
/**
* Array of child nodes.
*
*/
@JsonProperty("children")
public Set getChildren() {
return children;
}
/**
* Array of child nodes.
*
*/
@JsonProperty("children")
public void setChildren(Set children) {
this.children = children;
}
public Node withChildren(Set children) {
this.children = children;
return this;
}
/**
* Key/value pairs that provide additional information about the object.
*
*/
@JsonProperty("properties")
public PropertyBag getProperties() {
return properties;
}
/**
* Key/value pairs that provide additional information about the object.
*
*/
@JsonProperty("properties")
public void setProperties(PropertyBag properties) {
this.properties = properties;
}
public Node withProperties(PropertyBag properties) {
this.properties = properties;
return this;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(Node.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
sb.append("id");
sb.append('=');
sb.append(((this.id == null)?"":this.id));
sb.append(',');
sb.append("label");
sb.append('=');
sb.append(((this.label == null)?"":this.label));
sb.append(',');
sb.append("location");
sb.append('=');
sb.append(((this.location == null)?"":this.location));
sb.append(',');
sb.append("children");
sb.append('=');
sb.append(((this.children == null)?"":this.children));
sb.append(',');
sb.append("properties");
sb.append('=');
sb.append(((this.properties == null)?"":this.properties));
sb.append(',');
if (sb.charAt((sb.length()- 1)) == ',') {
sb.setCharAt((sb.length()- 1), ']');
} else {
sb.append(']');
}
return sb.toString();
}
@Override
public int hashCode() {
int result = 1;
result = ((result* 31)+((this.location == null)? 0 :this.location.hashCode()));
result = ((result* 31)+((this.id == null)? 0 :this.id.hashCode()));
result = ((result* 31)+((this.label == null)? 0 :this.label.hashCode()));
result = ((result* 31)+((this.children == null)? 0 :this.children.hashCode()));
result = ((result* 31)+((this.properties == null)? 0 :this.properties.hashCode()));
return result;
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if ((other instanceof Node) == false) {
return false;
}
Node rhs = ((Node) other);
return ((((((this.location == rhs.location)||((this.location!= null)&&this.location.equals(rhs.location)))&&((this.id == rhs.id)||((this.id!= null)&&this.id.equals(rhs.id))))&&((this.label == rhs.label)||((this.label!= null)&&this.label.equals(rhs.label))))&&((this.children == rhs.children)||((this.children!= null)&&this.children.equals(rhs.children))))&&((this.properties == rhs.properties)||((this.properties!= null)&&this.properties.equals(rhs.properties))));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy