All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.deepoove.swagger.diff.model.ChangedExtensionGroup Maven / Gradle / Ivy

package com.deepoove.swagger.diff.model;

import java.util.LinkedHashMap;
import java.util.Map;

import org.apache.commons.lang3.tuple.Pair;

public class ChangedExtensionGroup {
  protected Map increasedVendorExtensions = new LinkedHashMap();
  protected Map missingVendorExtensions = new LinkedHashMap();
  protected Map> changedVendorExtensions = new LinkedHashMap>();
  protected Map changedSubGroups = new LinkedHashMap();

  public boolean vendorExtensionsAreDiffShallow() {
    return !(increasedVendorExtensions.isEmpty()
        && changedVendorExtensions.isEmpty()
        && missingVendorExtensions.isEmpty());
  }

  public boolean vendorExtensionsAreDiff() {
    return vendorExtensionsAreDiffShallow()
        || subVendorExtensionsAreDiff();
  }

  private boolean subVendorExtensionsAreDiff() {
    boolean accumulator = false;
    for (ChangedExtensionGroup subgroup : changedSubGroups.values()) {
      accumulator = accumulator || subgroup.vendorExtensionsAreDiff();
    }
    return accumulator;
  }

  public Map getIncreasedVendorExtensions() {
    return increasedVendorExtensions;
  }

  public void setIncreasedVendorExtensions(Map increasedVendorExtensions) {
    this.increasedVendorExtensions = increasedVendorExtensions;
  }

  public Map getMissingVendorExtensions() {
    return missingVendorExtensions;
  }

  public void setMissingVendorExtensions(Map missingVendorExtensions) {
    this.missingVendorExtensions = missingVendorExtensions;
  }

  public Map> getChangedVendorExtensions() {
    return changedVendorExtensions;
  }

  public void setChangedVendorExtensions(Map> changedVendorExtensions) {
    this.changedVendorExtensions = changedVendorExtensions;
  }

  public Map getChangedSubGroups() {
    return changedSubGroups;
  }

  public boolean hasSubGroup(String key) {
    return changedSubGroups.containsKey(key);
  }

  public ChangedExtensionGroup getSubGroup(String key) {
    return changedSubGroups.get(key);
  }

  public void putSubGroup(String key, ChangedExtensionGroup group) {
    changedSubGroups.put(key, group);
  }

  public void setVendorExtsFromGroup(ChangedExtensionGroup newDiffs) {
    this.increasedVendorExtensions = newDiffs.getIncreasedVendorExtensions();
    this.missingVendorExtensions = newDiffs.getMissingVendorExtensions();
    this.changedVendorExtensions = newDiffs.getChangedVendorExtensions();
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy