Package org.neo4j.ogm.utils
Class RelationshipUtils
java.lang.Object
org.neo4j.ogm.utils.RelationshipUtils
Contains helper methods to facilitate inference of relationship types from field and methods and vice versa.
All methods follow the same convention that relationship types are UPPER_SNAKE_CASE and that fields appear in lowerCamelCase. The de-facto Java Bean getter/setter pattern is also assumed when inferring accessor methods.
The utility methods here will all throw aNullPointerException
if invoked with null
.- Author:
- Adam George
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
inferFieldName
(String relationshipType) Infers the name of the instance variable that corresponds to the given relationship type.static String
inferGetterName
(String relationshipType) Infers the name of the getter method that corresponds to the given relationship type.static String
inferRelationshipType
(String memberName) Infers the relationship type that corresponds to the given field or access method name.static String
inferSetterName
(String relationshipType) Infers the name of the setter method that corresponds to the given relationship type.
-
Constructor Details
-
RelationshipUtils
public RelationshipUtils()
-
-
Method Details
-
inferRelationshipType
Infers the relationship type that corresponds to the given field or access method name. This method is called when no annotation exists by which to determine the relationship type between two nodes.- Parameters:
memberName
- The member name from which to infer the relationship type- Returns:
- The resolved relationship type
-
inferSetterName
Infers the name of the setter method that corresponds to the given relationship type.- Parameters:
relationshipType
- The relationship type from which to infer the setter name- Returns:
- The inferred setter method name
-
inferGetterName
Infers the name of the getter method that corresponds to the given relationship type.- Parameters:
relationshipType
- The relationship type from which to infer the getter name- Returns:
- The inferred getter method name
-
inferFieldName
Infers the name of the instance variable that corresponds to the given relationship type.- Parameters:
relationshipType
- The relationship type from which to infer the name of the field- Returns:
- The inferred field name
-