Skip to content

Commit

Permalink
Bug 564566 rework passage settings dirs supplying
Browse files Browse the repository at this point in the history
 - `LicensingConfiguration`, even deprecated, must be implemented as a
data-class according to expectations

Signed-off-by: elena.parovyshnaya <[email protected]>
  • Loading branch information
eparovyshnaya committed Jun 25, 2020
1 parent 4bb4ef4 commit bbe0f20
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@
package org.eclipse.passage.lic.base;

import java.util.Map;
import java.util.Objects;

import org.eclipse.passage.lic.api.LicensingConfiguration;
import org.eclipse.passage.lic.internal.base.BaseLicensedProduct;
import org.eclipse.passage.lic.internal.base.NamedData;
import org.eclipse.passage.lic.internal.base.ProductIdentifier;
import org.eclipse.passage.lic.internal.base.ProductVersion;

/**
*
Expand Down Expand Up @@ -69,6 +72,35 @@ public String getProductVersion() {
return version;
}

@Override
public int hashCode() {
return Objects.hash(id, version);
}

@Override
public boolean equals(Object obj) {
if (!LicensingConfiguration.class.isInstance(obj)) {
return false;
}
LicensingConfiguration other = (LicensingConfiguration) obj;
if (!Objects.equals(id, other.getProductIdentifier())) {
return false;
}
if (!Objects.equals(version, other.getProductVersion())) {
return false;
}
return true;
}

@Override
public String toString() {
StringBuilder output = new StringBuilder();
new NamedData.Writable<String>(new ProductIdentifier(id)).write(output);
output.append(';');
new NamedData.Writable<String>(new ProductVersion(version)).write(output);
return output.toString();
}

}

}

0 comments on commit bbe0f20

Please sign in to comment.