Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright 2011 the original author or authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

    private final RelationshipHelper relationshipHelper;
    private final Neo4jPersistentProperty property;
    private final Neo4jPersistentProperty endNodeProperty;
    private final MappingPolicy endNodeMappingPolicy;
    private final MappingPolicy startNodeMappingPolicy;
    public RelationshipEntities(RelationshipHelper relationshipHelperNeo4jPersistentProperty property) {
        this. = relationshipHelper;
        this. = property;
    public Node getOtherNode(Node startNodeObject relationshipEntity) {
        Object fieldValue = .getValue(relationshipEntity);
        if (fieldValue == null)
            throw new IllegalArgumentException("End node must not be null (" + relationshipEntity.getClass().getName() + ")");
        final Node endNode = .getNode(fieldValue);
        if (startNode.equals(endNode)) {
            return .getNode(.getValue(relationshipEntity));
        } else {
            return endNode;
    public Map<NodeObjectloadEndNodeToRelationshipEntityMapping(Node startNodeIterable<ObjectvaluesClass<?> relatedType) {
        Map<NodeObjectendNodeToEntityMapping = new HashMap<NodeObject>();
        for (Object entry : values) {
            if (!relatedType.isInstance(entry))
                throw new IllegalArgumentException("Elements of " +  + " collection must be of " + relatedType);
            Node endNode = getOtherNode(startNodeentry);
        return endNodeToEntityMapping;
New to GrepCode? Check out our FAQ X