Interface Schema
- All Known Implementing Classes:
Neo4jMappingContext
@API(status=INTERNAL,
since="6.0")
public interface Schema
Contains the descriptions of all nodes, their properties and relationships known to SDN.
- Since:
- 6.0
- Author:
- Michael J. Simons
-
Method Summary
Modifier and TypeMethodDescription<T extends IdGenerator<?>>
Optional<T>getIdGenerator
(String reference) getNodeDescription
(Class<?> underlyingClass) Retrieves a node's description by its underlying class.getNodeDescription
(String primaryLabel) Retrieves a node's description by its primary label.<T extends IdGenerator<?>>
TgetOrCreateIdGeneratorOfType
(Class<T> idGeneratorType) Creates or retrieves an instance of the given id generator class.getRequiredBinderFunctionFor
(Class<T> sourceClass) default <T> BiFunction<org.neo4j.driver.types.TypeSystem,
org.neo4j.driver.types.MapAccessor, T> getRequiredMappingFunctionFor
(Class<T> targetClass) Retrieves a schema based mapping function for thetargetClass
.default NodeDescription<?>
getRequiredNodeDescription
(Class<?> underlyingClass) default NodeDescription<?>
getRequiredNodeDescription
(String primaryLabel)
-
Method Details
-
getNodeDescription
Retrieves a node's description by its primary label.- Parameters:
primaryLabel
- The primary label under which the node is described- Returns:
- The description if any, null otherwise
-
getNodeDescription
Retrieves a node's description by its underlying class.- Parameters:
underlyingClass
- The underlying class of the node description to be retrieved- Returns:
- The description if any, null otherwise
-
getRequiredNodeDescription
-
getRequiredNodeDescription
-
getRequiredMappingFunctionFor
default <T> BiFunction<org.neo4j.driver.types.TypeSystem,org.neo4j.driver.types.MapAccessor, getRequiredMappingFunctionForT> (Class<T> targetClass) Retrieves a schema based mapping function for thetargetClass
. The mapping function will expect a record containing all the nodes and relationships necessary to fully populate an instance of the given class. It will not try to fetch data from any other records or queries. The mapping function is free to throw aRuntimeException
, most likely aorg.springframework.data.mapping.MappingException
orIllegalStateException
when mapping is not possible.In case the mapping function returns a null, the Neo4j client will throw an exception and prevent further processing.
- Type Parameters:
T
- Type of the target class- Parameters:
targetClass
- The target class to which to map to.- Returns:
- The default, stateless and reusable mapping function for the given target class
- Throws:
UnknownEntityException
- WhentargetClass
is not a managed class
-
getEntityConverter
Neo4jEntityConverter getEntityConverter()- Returns:
- The (reading and writing) converter used to read records into entities and write entities into maps.
-
getRequiredBinderFunctionFor
-
getOrCreateIdGeneratorOfType
Creates or retrieves an instance of the given id generator class. During the lifetime of the schema, this method returns the same instance of reoccurring requests of the same type.- Parameters:
idGeneratorType
- The type of the ID generator to return- Returns:
- The id generator.
-
getIdGenerator
-