Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/main/java/org/cyclonedx/model/Attribute.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.cyclonedx.model;

import java.util.Objects;

public class Attribute {

private final String key;
Expand All @@ -36,4 +38,20 @@ public String getValue() {
return this.value;
}

@Override
public boolean equals(final Object object) {
if (this == object) {
return true;
}
if (!(object instanceof Attribute)) {
return false;
}
Attribute attribute = (Attribute) object;
return Objects.equals(key, attribute.key) && Objects.equals(value, attribute.value);
}

@Override
public int hashCode() {
return Objects.hash(key, value);
}
}
21 changes: 21 additions & 0 deletions src/main/java/org/cyclonedx/model/Composition.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(Include.NON_EMPTY)
Expand Down Expand Up @@ -142,4 +143,24 @@ public void addVulnerability(BomReference vulnerability) {
}
vulnerabilities.add(vulnerability);
}

@Override
public boolean equals(final Object object) {
if (this == object) {
return true;
}
if (!(object instanceof Composition)) {
return false;
}
Composition that = (Composition) object;
return Objects.equals(bomRef, that.bomRef) && aggregate == that.aggregate &&
Objects.equals(assemblies, that.assemblies) &&
Objects.equals(dependencies, that.dependencies) &&
Objects.equals(vulnerabilities, that.vulnerabilities);
}

@Override
public int hashCode() {
return Objects.hash(bomRef, aggregate, assemblies, dependencies, vulnerabilities);
}
}
19 changes: 19 additions & 0 deletions src/main/java/org/cyclonedx/model/Copyright.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.cyclonedx.model;

import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
Expand All @@ -42,4 +44,21 @@ public String getText() {
public void setText(String text) {
this.text = text;
}

@Override
public boolean equals(final Object object) {
if (this == object) {
return true;
}
if (!(object instanceof Copyright)) {
return false;
}
Copyright copyright = (Copyright) object;
return Objects.equals(text, copyright.text);
}

@Override
public int hashCode() {
return Objects.hashCode(text);
}
}
19 changes: 19 additions & 0 deletions src/main/java/org/cyclonedx/model/Diff.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.cyclonedx.model;

import java.util.Objects;

public class Diff {

private AttachmentText text;
Expand All @@ -38,4 +40,21 @@ public String getUrl() {
public void setUrl(final String url) {
this.url = url;
}

@Override
public boolean equals(final Object object) {
if (this == object) {
return true;
}
if (!(object instanceof Diff)) {
return false;
}
Diff diff = (Diff) object;
return Objects.equals(text, diff.text) && Objects.equals(url, diff.url);
}

@Override
public int hashCode() {
return Objects.hash(text, url);
}
}
22 changes: 22 additions & 0 deletions src/main/java/org/cyclonedx/model/Evidence.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@SuppressWarnings("unused")
@JsonIgnoreProperties(ignoreUnknown = true)
Expand Down Expand Up @@ -125,4 +126,25 @@ public List<Identity> getIdentities() {
public void setIdentities(final List<Identity> identities) {
this.identities = identities;
}

@Override
public boolean equals(final Object object) {
if (this == object) {
return true;
}
if (!(object instanceof Evidence)) {
return false;
}
Evidence evidence = (Evidence) object;
return Objects.equals(licenses, evidence.licenses) &&
Objects.equals(copyright, evidence.copyright) &&
Objects.equals(identities, evidence.identities) &&
Objects.equals(occurrences, evidence.occurrences) &&
Objects.equals(callstack, evidence.callstack);
}

@Override
public int hashCode() {
return Objects.hash(licenses, copyright, identities, occurrences, callstack);
}
}
20 changes: 20 additions & 0 deletions src/main/java/org/cyclonedx/model/Issue.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_EMPTY)
Expand Down Expand Up @@ -123,4 +124,23 @@ public Type getType() {
public void setType(Type type) {
this.type = type;
}

@Override
public boolean equals(final Object object) {
if (this == object) {
return true;
}
if (!(object instanceof Issue)) {
return false;
}
Issue issue = (Issue) object;
return Objects.equals(id, issue.id) && Objects.equals(name, issue.name) &&
Objects.equals(description, issue.description) && Objects.equals(source, issue.source) &&
Objects.equals(references, issue.references) && type == issue.type;
}

@Override
public int hashCode() {
return Objects.hash(id, name, description, source, references, type);
}
}
20 changes: 20 additions & 0 deletions src/main/java/org/cyclonedx/model/LifecycleChoice.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.cyclonedx.model;

import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down Expand Up @@ -99,4 +101,22 @@ public Phase getPhase() {
public void setPhase(final Phase phase) {
this.phase = phase;
}

@Override
public boolean equals(final Object object) {
if (this == object) {
return true;
}
if (!(object instanceof LifecycleChoice)) {
return false;
}
LifecycleChoice choice = (LifecycleChoice) object;
return phase == choice.phase && Objects.equals(name, choice.name) &&
Objects.equals(description, choice.description);
}

@Override
public int hashCode() {
return Objects.hash(phase, name, description);
}
}
18 changes: 18 additions & 0 deletions src/main/java/org/cyclonedx/model/Lifecycles.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.cyclonedx.model;

import java.util.List;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
Expand All @@ -36,4 +37,21 @@ public List<LifecycleChoice> getLifecycleChoice() {
public void setLifecycleChoice(final List<LifecycleChoice> lifecycleChoice) {
this.lifecycleChoice = lifecycleChoice;
}

@Override
public boolean equals(final Object object) {
if (this == object) {
return true;
}
if (!(object instanceof Lifecycles)) {
return false;
}
Lifecycles that = (Lifecycles) object;
return Objects.equals(lifecycleChoice, that.lifecycleChoice);
}

@Override
public int hashCode() {
return Objects.hashCode(lifecycleChoice);
}
}
20 changes: 20 additions & 0 deletions src/main/java/org/cyclonedx/model/Patch.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
package org.cyclonedx.model;

import java.util.List;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down Expand Up @@ -83,4 +85,22 @@ public Type getType() {
public void setType(Type type) {
this.type = type;
}

@Override
public boolean equals(final Object object) {
if (this == object) {
return true;
}
if (!(object instanceof Patch)) {
return false;
}
Patch patch = (Patch) object;
return type == patch.type && Objects.equals(diff, patch.diff) &&
Objects.equals(resolves, patch.resolves);
}

@Override
public int hashCode() {
return Objects.hash(type, diff, resolves);
}
}
25 changes: 25 additions & 0 deletions src/main/java/org/cyclonedx/model/ReleaseNotes.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.util.Date;
import java.util.List;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down Expand Up @@ -289,4 +290,28 @@ public void setText(final AttachmentText text) {
this.text = text;
}
}

@Override
public boolean equals(final Object object) {
if (this == object) {
return true;
}
if (!(object instanceof ReleaseNotes)) {
return false;
}
ReleaseNotes that = (ReleaseNotes) object;
return Objects.equals(type, that.type) && Objects.equals(title, that.title) &&
Objects.equals(featuredImage, that.featuredImage) &&
Objects.equals(socialImage, that.socialImage) &&
Objects.equals(description, that.description) && Objects.equals(timestamp, that.timestamp) &&
Objects.equals(aliases, that.aliases) && Objects.equals(tags, that.tags) &&
Objects.equals(resolves, that.resolves) && Objects.equals(notes, that.notes) &&
Objects.equals(properties, that.properties);
}

@Override
public int hashCode() {
return Objects.hash(type, title, featuredImage, socialImage, description, timestamp, aliases, tags, resolves, notes,
properties);
}
}
32 changes: 32 additions & 0 deletions src/main/java/org/cyclonedx/model/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

@SuppressWarnings("unused")
@JsonIgnoreProperties(ignoreUnknown = true)
Expand Down Expand Up @@ -266,4 +267,35 @@ public Tags getTags() {
public void setTags(final Tags tags) {
this.tags = tags;
}

@Override
public boolean equals(final Object object) {
if (this == object) {
return true;
}
if (!(object instanceof Service)) {
return false;
}
Service service = (Service) object;
return Objects.equals(bomRef, service.bomRef) && Objects.equals(provider, service.provider) &&
Objects.equals(group, service.group) && Objects.equals(name, service.name) &&
Objects.equals(version, service.version) &&
Objects.equals(description, service.description) &&
Objects.equals(endpoints, service.endpoints) &&
Objects.equals(authenticated, service.authenticated) &&
Objects.equals(xTrustBoundary, service.xTrustBoundary) &&
Objects.equals(data, service.data) && Objects.equals(licenses, service.licenses) &&
Objects.equals(externalReferences, service.externalReferences) &&
Objects.equals(properties, service.properties) && Objects.equals(tags, service.tags) &&
Objects.equals(services, service.services) &&
Objects.equals(releaseNotes, service.releaseNotes) &&
Objects.equals(signature, service.signature);
}

@Override
public int hashCode() {
return Objects.hash(bomRef, provider, group, name, version, description, endpoints, authenticated,
xTrustBoundary,
data, licenses, externalReferences, properties, tags, services, releaseNotes, signature);
}
}
19 changes: 19 additions & 0 deletions src/main/java/org/cyclonedx/model/Source.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
package org.cyclonedx.model;

import java.net.URL;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
Expand Down Expand Up @@ -49,4 +51,21 @@ public String getName() {
public void setName(final String name) {
this.name = name;
}

@Override
public boolean equals(final Object object) {
if (this == object) {
return true;
}
if (!(object instanceof Source)) {
return false;
}
Source source = (Source) object;
return Objects.equals(name, source.name) && Objects.equals(url, source.url);
}

@Override
public int hashCode() {
return Objects.hash(name, url);
}
}
Loading