Annotation Type Required
When is this annotation useful?
- You have a plain Java application with some models but no object mapper on the classpath but you still want to derive content
- You are a Spring Data Neo4j (SDN6+) user and want to enrich your models with unique or existential constraints
- You are an Neo4j-OGM user but are looking for an object mapper agnostic way of enriching your model
Determining labels or types: Depending on your approach and combination with other annotations (such as SDN6+ or OGM annotations), the process is as following
- Explicitly use
label()
ortype()
()} - On a plain class: The simple class name is used as label (we default to targeting nodes)
- If combined any of the following SDN6+ annotations
org.springframework.data.neo4j.core.schema.Node
ororg.springframework.data.neo4j.core.schema.RelationshipProperties
, we default to the SDN6 approach - If combined with an Neo4j-OGM annotation, we default to the Neo4j-OGM approach
Determining node or relationship: We default to nodes and labels. If you want to generate constraints for
relationships, you must either combine this annotation with one of org.springframework.data.neo4j.core.schema.RelationshipProperties
from SDN6+ or org.neo4j.ogm.annotation.Relationship
or you can explicitly use the type()
attribute of this
annotation.
This annotation can be used to derive catalogs that contain constraints that are only available in enterprise edition. We don't check this during generation. Please make sure that your targeted database suits those constraints.
This annotation can also be repeated on a class. If you decide to put contradicting information on a class, for example targeting labels with one annotation and relationships with another, we won't stop you as long as we can resolve both error free: You might end up with a catalog that defines several constraints coming from one type and aiming for both nodes and relationship constraints.
- Since:
- 1.15.0
- Author:
- Michael J. Simons
- Soundtrack
- Juse Ju - Shibuya Crossing
-
Optional Element Summary
Modifier and TypeOptional ElementDescriptionIf this is not null, it has precedence overtype()
and the simple class name, but not over dedicated OGM or SDN6 annotations explicitly specifying the label or type explicitly.Can be used to specify the type (and therefor a relationship target), has no precedence over dedicated OGM or SDN6 annotations with explicit label or type values.
-
Element Details
-
label
String labelIf this is not null, it has precedence overtype()
and the simple class name, but not over dedicated OGM or SDN6 annotations explicitly specifying the label or type explicitly. Its use must be consistent throughout the class.- Returns:
- The target label
- Default:
- ""
-
type
String typeCan be used to specify the type (and therefor a relationship target), has no precedence over dedicated OGM or SDN6 annotations with explicit label or type values.- Returns:
- The target (relationship) type
- Default:
- ""
-
property
String property- Returns:
- The property required to exist on the given label or type
- Default:
- ""
-