You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Method.java 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. @VaadinApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.terminal.gwt.client.metadata;
  5. public class Method {
  6. private final Type type;
  7. private final String name;
  8. public Method(Type type, String name) {
  9. this.type = type;
  10. this.name = name;
  11. }
  12. public Type getType() {
  13. return type;
  14. }
  15. public String getName() {
  16. return name;
  17. }
  18. public Type getReturnType() {
  19. return TypeDataStore.getReturnType(this);
  20. }
  21. public void invoke(Object target, Object... params) {
  22. TypeDataStore.getInvoker(this).invoke(target, params);
  23. }
  24. public String getSignature() {
  25. return type.toString() + "." + name;
  26. }
  27. @Override
  28. public boolean equals(Object obj) {
  29. if (obj == this) {
  30. return true;
  31. } else if (obj instanceof Method) {
  32. Method other = (Method) obj;
  33. return other.getSignature().equals(getSignature());
  34. } else {
  35. return false;
  36. }
  37. }
  38. @Override
  39. public int hashCode() {
  40. return getSignature().hashCode();
  41. }
  42. }