mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-14 17:26:22 +01:00
fixed duplicate filter bindings
This commit is contained in:
@@ -38,6 +38,7 @@ import sonia.scm.xml.XmlArrayStringAdapter;
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
@@ -46,6 +47,8 @@ import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
|
||||
|
||||
/**
|
||||
* Descriptor for web elements such as filter or servlets. A web element can be registered by using the
|
||||
* {@link sonia.scm.filter.WebElement} annotation.
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @since 2.0.0
|
||||
@@ -136,6 +139,30 @@ public final class WebElementDescriptor
|
||||
return regex;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(clazz, pattern, Arrays.hashCode(morePatterns), regex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final WebElementDescriptor other = (WebElementDescriptor) obj;
|
||||
return Objects.equals(clazz, other.clazz)
|
||||
&& Objects.equals(pattern, other.pattern)
|
||||
&& Arrays.equals(morePatterns, other.morePatterns)
|
||||
&& this.regex == other.regex;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
|
||||
@@ -28,12 +28,15 @@
|
||||
*/
|
||||
package sonia.scm.filter;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import sonia.scm.plugin.WebElementDescriptor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
* @param <T>
|
||||
* @since 2.0.0
|
||||
*/
|
||||
public final class TypedWebElementDescriptor<T>
|
||||
{
|
||||
@@ -57,4 +60,26 @@ public final class TypedWebElementDescriptor<T>
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(clazz, descriptor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
final TypedWebElementDescriptor other = (TypedWebElementDescriptor) obj;
|
||||
return Objects.equals(clazz, other.clazz)
|
||||
&& Objects.equals(descriptor, other.descriptor);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user