From 08a594ef4ce181a960e73887ffe1bc8bf05714cd Mon Sep 17 00:00:00 2001 From: ioannispan Date: Thu, 15 Aug 2024 16:25:08 +0200 Subject: [PATCH] del --- .../org/neo4j/gds/ProcedureMethodHelper.java | 67 ------------------- 1 file changed, 67 deletions(-) delete mode 100644 proc/test/src/main/java/org/neo4j/gds/ProcedureMethodHelper.java diff --git a/proc/test/src/main/java/org/neo4j/gds/ProcedureMethodHelper.java b/proc/test/src/main/java/org/neo4j/gds/ProcedureMethodHelper.java deleted file mode 100644 index 349500aee8..0000000000 --- a/proc/test/src/main/java/org/neo4j/gds/ProcedureMethodHelper.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) "Neo4j" - * Neo4j Sweden AB [http://neo4j.com] - * - * This file is part of Neo4j. - * - * Neo4j is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package org.neo4j.gds; - -import org.neo4j.procedure.Procedure; - -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.Objects; -import java.util.stream.Stream; - -public final class ProcedureMethodHelper { - - public static String methodName(Method method) { - Procedure procedureAnnotation = method.getDeclaredAnnotation(Procedure.class); - Objects.requireNonNull(procedureAnnotation, method + " is not annotation with " + Procedure.class); - String name = procedureAnnotation.name(); - if (name.isEmpty()) { - name = procedureAnnotation.value(); - } - return name; - } - - public static Stream nonEstimateMethods(BaseProc proc) { - return methods(proc).filter(procMethod -> !methodName(procMethod).endsWith(".estimate")); - } - - public static Stream writeMethods(BaseProc proc) { - return methods(proc).filter(procMethod -> methodName(procMethod).endsWith(".write")); - } - - public static Stream mutateMethods(BaseProc proc) { - return methods(proc).filter(procMethod -> methodName(procMethod).endsWith(".mutate")); - } - - public static Stream streamMethods(BaseProc proc) { - return methods(proc).filter(procMethod -> methodName(procMethod).endsWith(".stream")); - } - - public static Stream statsMethods(BaseProc proc) { - return methods(proc).filter(procMethod -> methodName(procMethod).endsWith(".stats")); - } - - private static Stream methods(BaseProc proc) { - return Arrays.stream(proc.getClass().getDeclaredMethods()) - .filter(method -> method.getDeclaredAnnotation(Procedure.class) != null); - } - - private ProcedureMethodHelper() {} -}