1919import java .util .Objects ;
2020
2121/**
22- * Represents a specific distribution of Neo4j, encapsulating the version and edition of the database.
23- * This class provides methods to check for the availability of various features and constraints
24- * based on the edition and version of the Neo4j distribution.
25- * <p>
22+ * {@link Neo4jDistribution} represents the target distribution of Neo4j, encapsulating its version and edition<br>
23+ * {@link Neo4jDistribution} class provides methods to check for the availability of various features.
24+ * <br>
2625 * Assumptions:
27- * - Neo4j 4.4 is considered the minimum supported version. Therefore, certain features (like NodeRangeIndexes, NodePointIndexes etc.)
28- * are assumed to be always present in all supported versions.
26+ * - Neo4j 4.4 is considered the minimum supported version. Therefore, certain features (like NodeRangeIndexes,
27+ * NodePointIndexes etc.) are assumed to be always present
2928 */
3029public class Neo4jDistribution {
3130 private final String versionString ;
@@ -38,82 +37,163 @@ public class Neo4jDistribution {
3837 this .versionString = String .format ("Neo4j %s %s" , version , edition );
3938 }
4039
40+ /**
41+ * Whether this database version is larger than or equal to the provided raw version
42+ * @param versionString raw Neo4j version
43+ * @return true if this database version is larger than or equal to the provided raw version, false otherwise
44+ */
4145 public boolean isVersionLargerThanOrEqual (String versionString ) {
4246 return version .isLargerThanOrEqual (versionString );
4347 }
4448
49+ /**
50+ * Whether this database edition is enterprise
51+ * @return true if this database edition is enterprise, false otherwise
52+ */
4553 public boolean isEnterprise () {
4654 return edition != Neo4jDistributions .Edition .COMMUNITY ;
4755 }
4856
57+ /**
58+ * Whether this database supports node property type constraints
59+ * @return true if this database supports node property type constraints, false otherwise
60+ */
4961 public boolean hasNodeTypeConstraints () {
5062 return isEnterprise () && version .isLargerThanOrEqual ("5.9" );
5163 }
5264
65+ /**
66+ * Whether this database supports node key constraints
67+ * @return true if this database supports node key constraints, false otherwise
68+ */
5369 public boolean hasNodeKeyConstraints () {
5470 return isEnterprise ();
5571 }
5672
73+ /**
74+ * Whether this database supports node unique constraints
75+ * @return true if this database supports node unique constraints, false otherwise
76+ */
5777 public boolean hasNodeUniqueConstraints () {
5878 return true ;
5979 }
6080
81+ /**
82+ * Whether this database supports node property existence constraints
83+ * @return true if this database supports node property existence constraints, false otherwise
84+ */
6185 public boolean hasNodeExistenceConstraints () {
6286 return isEnterprise ();
6387 }
6488
89+ /**
90+ * Whether this database supports node range indexes
91+ * @return true if this database supports node range indexes, false otherwise
92+ */
6593 public boolean hasNodeRangeIndexes () {
6694 return true ;
6795 }
6896
97+ /**
98+ * Whether this database supports node text indexes
99+ * @return true if this database supports node text indexes, false otherwise
100+ */
69101 public boolean hasNodeTextIndexes () {
70102 return true ;
71103 }
72104
105+ /**
106+ * Whether this database supports node point indexes
107+ * @return true if this database supports node point indexes, false otherwise
108+ */
73109 public boolean hasNodePointIndexes () {
74110 return true ;
75111 }
76112
113+ /**
114+ * Whether this database supports node full-text indexes
115+ * @return true if this database supports node full-text indexes, false otherwise
116+ */
77117 public boolean hasNodeFullTextIndexes () {
78118 return true ;
79119 }
80120
121+ /**
122+ * Whether this database supports node vector indexes
123+ * @return true if this database supports node vector indexes, false otherwise
124+ */
81125 public boolean hasNodeVectorIndexes () {
82126 return version .isLargerThanOrEqual ("5.13" );
83127 }
84128
129+ /**
130+ * Whether this database supports relationship key constraints
131+ * @return true if this database supports relationship key constraints, false otherwise
132+ */
85133 public boolean hasRelationshipKeyConstraints () {
86134 return isEnterprise () && version .isLargerThanOrEqual ("5.7" );
87135 }
88136
137+ /**
138+ * Whether this database supports relationship property type constraints
139+ * @return true if this database supports relationship property type constraints, false otherwise
140+ */
89141 public boolean hasRelationshipTypeConstraints () {
90142 return isEnterprise () && version .isLargerThanOrEqual ("5.9" );
91143 }
92144
145+ /**
146+ * Whether this database supports relationship unique constraints
147+ * @return true if this database supports relationship unique constraints, false otherwise
148+ */
93149 public boolean hasRelationshipUniqueConstraints () {
94150 return version .isLargerThanOrEqual ("5.7" );
95151 }
96152
153+ /**
154+ * Whether this database supports relationship property existence constraints
155+ * @return true if this database supports relationship property existence constraints, false otherwise
156+ */
97157 public boolean hasRelationshipExistenceConstraints () {
98158 return isEnterprise ();
99159 }
100160
161+ /**
162+ * Whether this database supports relationship range indexes
163+ * @return true if this database supports relationship range indexes, false otherwise
164+ */
101165 public boolean hasRelationshipRangeIndexes () {
102166 return isEnterprise ();
103167 }
104168
169+ /**
170+ * Whether this database supports relationship text indexes
171+ * @return true if this database supports relationship text indexes, false otherwise
172+ */
105173 public boolean hasRelationshipTextIndexes () {
106174 return true ;
107175 }
108176
177+ /**
178+ * Whether this database supports relationship point indexes
179+ * @return true if this database supports relationship point indexes, false otherwise
180+ */
109181 public boolean hasRelationshipPointIndexes () {
110182 return true ;
111183 }
112184
185+ /**
186+ * Whether this database supports relationship full-text indexes
187+ * @return true if this database supports relationship full-text indexes, false otherwise
188+ */
113189 public boolean hasRelationshipFullTextIndexes () {
114190 return true ;
115191 }
116192
193+ /**
194+ * Whether this database supports relationship vector indexes
195+ * @return true if this database supports relationship vector indexes, false otherwise
196+ */
117197 public boolean hasRelationshipVectorIndexes () {
118198 return version .isLargerThanOrEqual ("5.13" );
119199 }
0 commit comments