Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void shouldAllowOverridingProcedureName() throws Throwable
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
        public virtual void ShouldAllowOverridingProcedureName()
        {
            // When
            CallableUserFunction proc = Compile(typeof(FunctionWithOverriddenName))[0];

            // Then
            assertEquals("org.mystuff.thisisActuallyTheName", proc.Signature().name().ToString());
        }
Пример #2
0
        public virtual UserFunctionHandle Function(QualifiedName name)
        {
            CallableUserFunction func = _functions.get(name);

            if (func == null)
            {
                return(null);
            }
            return(new UserFunctionHandle(func.Signature(), _functions.idOf(name)));
        }
Пример #3
0
        /// <summary>
        /// Register a new function.
        /// </summary>
        /// <param name="function"> the function. </param>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void register(org.neo4j.kernel.api.proc.CallableUserFunction function, boolean overrideCurrentImplementation) throws org.neo4j.internal.kernel.api.exceptions.ProcedureException
        public virtual void Register(CallableUserFunction function, bool overrideCurrentImplementation)
        {
            UserFunctionSignature signature = function.Signature();
            QualifiedName         name      = signature.Name();

            CallableUserFunction oldImplementation = _functions.get(name);

            if (oldImplementation == null)
            {
                _functions.put(name, function, signature.CaseInsensitive());
            }
            else
            {
                if (overrideCurrentImplementation)
                {
                    _functions.put(name, function, signature.CaseInsensitive());
                }
                else
                {
                    throw new ProcedureException(Org.Neo4j.Kernel.Api.Exceptions.Status_Procedure.ProcedureRegistrationFailed, "Unable to register function, because the name `%s` is already in use.", name);
                }
            }
        }