Package groovy.util
Class ObjectGraphBuilder.DefaultRelationNameResolver
java.lang.Object
groovy.util.ObjectGraphBuilder.DefaultRelationNameResolver
- All Implemented Interfaces:
ObjectGraphBuilder.RelationNameResolver
- Enclosing class:
- ObjectGraphBuilder
public static class ObjectGraphBuilder.DefaultRelationNameResolver
extends Object
implements ObjectGraphBuilder.RelationNameResolver
Default impl that returns parentName and childName accordingly.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionresolveChildRelationName
(String parentName, Object parent, String childName, Object child) Handles the common English regular plurals with the following rules.resolveParentRelationName
(String parentName, Object parent, String childName, Object child) Follow the most conventional pattern, returns the parentName unchanged.
-
Constructor Details
-
DefaultRelationNameResolver
public DefaultRelationNameResolver()
-
-
Method Details
-
resolveChildRelationName
public String resolveChildRelationName(String parentName, Object parent, String childName, Object child) Handles the common English regular plurals with the following rules.- If childName ends in {consonant}y, replace 'y' with "ies". For example, allergy to allergies.
- Otherwise, append 's'. For example, monkey to monkeys; employee to employees.
- Specified by:
resolveChildRelationName
in interfaceObjectGraphBuilder.RelationNameResolver
- Parameters:
parentName
- the name of the parent nodeparent
- the parent nodechildName
- the name of the child nodechild
- the child node- See Also:
-
resolveParentRelationName
public String resolveParentRelationName(String parentName, Object parent, String childName, Object child) Follow the most conventional pattern, returns the parentName unchanged.- Specified by:
resolveParentRelationName
in interfaceObjectGraphBuilder.RelationNameResolver
- Parameters:
parentName
- the name of the parent nodeparent
- the parent nodechildName
- the name of the child nodechild
- the child node
-