Kevin Krumwiede
Kevin Krumwiede

Reputation: 10308

Neo4j plugin @Name

I'm confused by a detail in the Neo4j plugin docs. The example GetAll class has two methods: one named getAllNodes and annotated with @Name( "get_all_nodes" ), and the other named getAllRelationships and not annotated with @Name. Further down the page, it shows how these methods appear in the API discovery response:

"extensions" : {
  "GetAll" : {
    "get_all_nodes" : "http://localhost:7474/db/data/ext/GetAll/graphdb/get_all_nodes",
    "get_all_relationships" : "http://localhost:7474/db/data/ext/GetAll/graphdb/getAllRelationships"
  }
}

How did getAllRelationships acquire the name get_all_relationships? Is this just a typo?

Upvotes: 0

Views: 25

Answers (1)

FylmTM
FylmTM

Reputation: 2007

I tested out this one. This is typo in documentation.

Neo4j version - 2.3.0

Result of this example on my machine:

$ curl -i http://localhost:7474/db/data/
HTTP/1.1 200 OK
Date: Thu, 22 Oct 2015 07:35:39 GMT
Content-Type: application/json; charset=UTF-8
Access-Control-Allow-Origin: *
Content-Length: 961
Server: Jetty(9.2.4.v20141103)

{
  "extensions" : {
    "GetAllNodes" : {
      "get_all_nodes" : "http://localhost:7474/db/data/ext/GetAllNodes/graphdb/get_all_nodes",
      "getAllRelationships" : "http://localhost:7474/db/data/ext/GetAllNodes/graphdb/getAllRelationships"
    }
  },
  // ...
}% 

As we can see:

  • If method has annotation, then name is acquired from annotation
  • If method don't have annotation, then name is acquired from method name

And finally - PluginPointFactoryImpl::nameOf - actual method that determines name.

Upvotes: 1

Related Questions