summaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc/lll/mapper/data/MethodSignature.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/ftbsc/lll/mapper/data/MethodSignature.java')
-rw-r--r--src/main/java/ftbsc/lll/mapper/data/MethodSignature.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/main/java/ftbsc/lll/mapper/data/MethodSignature.java b/src/main/java/ftbsc/lll/mapper/data/MethodSignature.java
new file mode 100644
index 0000000..d7515a8
--- /dev/null
+++ b/src/main/java/ftbsc/lll/mapper/data/MethodSignature.java
@@ -0,0 +1,51 @@
+package ftbsc.lll.mapper.data;
+
+import java.util.Objects;
+
+/**
+ * Container class for method signature data.
+ */
+public class MethodSignature {
+ /**
+ * The name of the method.
+ */
+ public final String name;
+
+ /**
+ * The descriptor of the method.
+ */
+ public final String descriptor;
+
+ /**
+ * Constructs a new {@link MethodSignature}. The parameters should be
+ * either plain or obfuscated in the same way;
+ * @param name the method name
+ * @param descriptor the method descriptor
+ */
+ public MethodSignature(String name, String descriptor) {
+ this.name = name;
+ this.descriptor = descriptor;
+ }
+
+ /**
+ * Checks if two {@link MethodSignature}s represent the same method.
+ * @param o the other signature
+ * @return whether they represent the same method
+ */
+ @Override
+ public boolean equals(Object o) {
+ if(this == o) return true;
+ if(o == null || getClass() != o.getClass()) return false;
+ MethodSignature signature = (MethodSignature) o;
+ return Objects.equals(name, signature.name) && Objects.equals(descriptor, signature.descriptor);
+ }
+
+ /**
+ * Calculates a hash based on name and descriptor.
+ * @return the hash code
+ */
+ @Override
+ public int hashCode() {
+ return Objects.hash(name, descriptor);
+ }
+}