@Target(value=METHOD) @Retention(value=RUNTIME) public @interface UserFunction
Functions accept input, use that input to perform work, and then return a value. The work performed usually
involves one or more resources, such as a GraphDatabaseService. Functions are read-only, i.e
can't update neither the graph nor update schema.
Name annotation, declaring the input name.
Valid input types are as follows:
StringLong or longDouble or doubleNumberBoolean or booleanNodeRelationshipPathMap with key String and value of any type in this list, including MapList with element type of any type in this list, including ListObject, meaning any valid input typesValid return types are as follows:
StringLong or longDouble or doubleNumberBoolean or booleanNodeRelationshipPathMap with key String and value of any type in this list, including MapList of elements of any valid field type, including ListObject, meaning any of the valid field typesContext annotation. Fields declared this way are automatically injected with the
requested resource. This is how functions gain access to APIs to do work with.
All fields in the class containing the function declaration must either be static; or it must be public, non-final
and annotated with Context.
Resources supported by default are as follows:
GraphDatabaseServiceLogIf you want to maintain state between invocations to your procedure, simply use a static field. Note that procedures may be called concurrently, meaning you need to take care to ensure the state you store in static fields can be safely accessed by multiple callers simultaneously.
| Modifier and Type | Optional Element and Description |
|---|---|
String[] |
allowed
Specifies role names such that a user that is assigned to any of these roles is allowed to execute this function,
regardless of any other permissions that the user has or doesn't have.
|
String |
deprecatedBy
When deprecating a function it is useful to indicate a possible
replacement procedure that clients might show in warnings
|
String |
name
Synonym for
value() |
String |
value
The namespace and name for the function, as a period-separated
string.
|
public abstract String value
myfunctions.myfunction.
If this is left empty, the name defaults to the package name of
the class the procedure is declared in, combined with the method
name. Notably, the class name is omitted.public abstract String deprecatedBy
public abstract String[] allowed
Copyright © 2002–2016 The Neo4j Graph Database Project. All rights reserved.