class SW360Release extends SW360HalResource<SW360ReleaseLinkObjects, SW360ReleaseEmbedded> {

    public SW360Release mergeWith(SW360Release releaseWithPrecedence) {
        name = getDominantGetterFromVariableMergeOrNull(releaseWithPrecedence, SW360Release::getName);
        version = getDominantGetterFromVariableMergeOrNull(releaseWithPrecedence, SW360Release::getVersion);
        cpeId = getDominantGetterFromVariableMergeOrNull(releaseWithPrecedence, SW360Release::getCpeId);
        downloadurl = getDominantGetterFromVariableMergeOrNull(releaseWithPrecedence, SW360Release::getDownloadurl);
        if (releaseWithPrecedence.isSetMainLicenseIds()) {
            setMainLicenseIds(releaseWithPrecedence.getMainLicenseIds());
        }
        Self releaseIdWithPrecedence = releaseWithPrecedence.getLinks().getSelf();
        if (releaseIdWithPrecedence != null && !releaseIdWithPrecedence.getHref().isEmpty()) {
            getLinks().setSelf(releaseIdWithPrecedence);
        }
        Self componentIdWithPrecedence = releaseWithPrecedence.getLinks().getSelfComponent();
        if (componentIdWithPrecedence != null && !componentIdWithPrecedence.getHref().isEmpty()) {
            getLinks().setSelfComponent(componentIdWithPrecedence);
        }
        final Set<SW360SparseAttachment> releaseWithPrecedenceAttachments = releaseWithPrecedence.getEmbedded().getAttachments();
        if (!releaseWithPrecedenceAttachments.isEmpty()) {
            if (getEmbedded().getAttachments().isEmpty()) {
                getEmbedded().setAttachments(releaseWithPrecedenceAttachments);
            } else {
                getEmbedded().setAttachments(mergeAttachments(getEmbedded().getAttachments(), releaseWithPrecedenceAttachments));
            }
        }
        externalIds.putAll(releaseWithPrecedence.externalIds);
        additionalData.putAll(releaseWithPrecedence.additionalData);

        return this;
    }

}