Neo4j Community

Class UniqueFactory<T extends PropertyContainer>

  extended by org.neo4j.graphdb.index.UniqueFactory<T>
Type Parameters:
T - the type of entity created by this UniqueFactory.
Direct Known Subclasses:
UniqueFactory.UniqueNodeFactory, UniqueFactory.UniqueRelationshipFactory

public abstract class UniqueFactory<T extends PropertyContainer>
extends Object

A utility class for creating unique (with regard to a given index) entities. Uses the putIfAbsent() method of the referenced index.

Tobias Lindaaker

Nested Class Summary
static class UniqueFactory.UniqueNodeFactory
          Implementation of UniqueFactory for Node.
static class UniqueFactory.UniqueRelationshipFactory
          Implementation of UniqueFactory for Relationship.
Method Summary
 T getOrCreate(String key, Object value)
          Get the indexed entity, creating it (exactly once) if no indexed entity exists.
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Detail


public final T getOrCreate(String key,
                           Object value)
Get the indexed entity, creating it (exactly once) if no indexed entity exists.

key - the key to find the entity under in the index.
value - the value the key is mapped to for the entity in the index.
the unique entity in the index.

Neo4j Community

Copyright © 2002-2013 The Neo4j Graph Database Project. All Rights Reserved.