import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Objects;
/**
* @author Decebal Suiu
return this;
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof DefaultPluginDescriptor)) return false;
+ DefaultPluginDescriptor that = (DefaultPluginDescriptor) o;
+ return Objects.equals(pluginId, that.pluginId) &&
+ Objects.equals(pluginDescription, that.pluginDescription) &&
+ Objects.equals(pluginClass, that.pluginClass) &&
+ Objects.equals(version, that.version) &&
+ Objects.equals(requires, that.requires) &&
+ Objects.equals(provider, that.provider) &&
+ dependencies.equals(that.dependencies) &&
+ Objects.equals(license, that.license);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(pluginId, pluginDescription, pluginClass, version, requires, provider, dependencies, license);
+ }
}
import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
+import java.util.Objects;
import java.util.Set;
/**
return this;
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof PluginClasspath)) return false;
+ PluginClasspath that = (PluginClasspath) o;
+ return classesDirectories.equals(that.classesDirectories) &&
+ jarsDirectories.equals(that.jarsDirectories);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(classesDirectories, jarsDirectories);
+ }
}
*/
package org.pf4j;
+import java.util.Objects;
+
/**
* @author Decebal Suiu
*/
+ optional + "]";
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (!(o instanceof PluginDependency)) return false;
+ PluginDependency that = (PluginDependency) o;
+ return optional == that.optional &&
+ pluginId.equals(that.pluginId) &&
+ pluginVersionSupport.equals(that.pluginVersionSupport);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(pluginId, pluginVersionSupport, optional);
+ }
}
@Test
public void testPluginDependecy() {
PluginDependency instance = new PluginDependency("test");
+ PluginDependency instance2 = new PluginDependency("test");
+ assertEquals(instance, instance2);
assertEquals("test", instance.getPluginId());
assertEquals("*", instance.getPluginVersionSupport());
assertFalse(instance.isOptional());
instance = new PluginDependency("test@");
+ instance2 = new PluginDependency("test@");
+ assertEquals(instance, instance2);
assertEquals("test", instance.getPluginId());
assertEquals("*", instance.getPluginVersionSupport());
assertFalse(instance.isOptional());
instance = new PluginDependency("test?");
+ instance2 = new PluginDependency("test?");
+ assertEquals(instance, instance2);
assertEquals("test", instance.getPluginId());
assertEquals("*", instance.getPluginVersionSupport());
assertTrue(instance.isOptional());
instance = new PluginDependency("test?@");
+ instance2 = new PluginDependency("test?@");
+ assertEquals(instance, instance2);
assertEquals("test", instance.getPluginId());
assertEquals("*", instance.getPluginVersionSupport());
assertTrue(instance.isOptional());
instance = new PluginDependency("test@1.0");
+ instance2 = new PluginDependency("test@1.0");
+ assertEquals(instance, instance2);
assertEquals("test", instance.getPluginId());
assertEquals("1.0", instance.getPluginVersionSupport());
assertFalse(instance.isOptional());
assertEquals("PluginDependency [pluginId=test, pluginVersionSupport=1.0, optional=false]", instance.toString());
instance = new PluginDependency("test?@1.0");
+ instance2 = new PluginDependency("test?@1.0");
+ assertEquals(instance, instance2);
assertEquals("test", instance.getPluginId());
assertEquals("1.0", instance.getPluginVersionSupport());
assertTrue(instance.isOptional());