コード例 #1
0
  /**
   * @return true if {@code method} is a static method of enum class, which is to be put into its
   *     class object (and not into the corresponding package). This applies to values() and
   *     valueOf(String) methods
   */
  public static boolean shouldBeInEnumClassObject(@NotNull JavaMethod method) {
    if (!method.getContainingClass().isEnum()) return false;

    String signature = JavaSignatureFormatter.getInstance().formatMethod(method);

    return "values()".equals(signature) || "valueOf(java.lang.String)".equals(signature);
  }
コード例 #2
0
 public static boolean isObjectMethod(@NotNull JavaMethod method) {
   String signature = JavaSignatureFormatter.getInstance().formatMethod(method);
   return "hashCode()".equals(signature)
       || "equals(java.lang.Object)".equals(signature)
       || "toString()".equals(signature);
 }