16
16
*/
17
17
public class RegistryClassInfo <R extends Keyed > extends ClassInfo <R > {
18
18
19
+ /**
20
+ * @param registryClass The registry class
21
+ * @param registry The registry
22
+ * @param codeName The name used in patterns
23
+ * @param languageNode The language node of the type
24
+ */
19
25
public RegistryClassInfo (Class <R > registryClass , Registry <R > registry , String codeName , String languageNode ) {
20
- this (registryClass , registry , codeName , languageNode , new EventValueExpression <>(registryClass ));
26
+ this (registryClass , registry , codeName , languageNode , new EventValueExpression <>(registryClass ), true );
27
+ }
28
+
29
+ /**
30
+ * @param registryClass The registry class
31
+ * @param registry The registry
32
+ * @param codeName The name used in patterns
33
+ * @param languageNode The language node of the type
34
+ * @param registerComparator Whether a default comparator should be registered for this registry's classinfo
35
+ */
36
+ public RegistryClassInfo (Class <R > registryClass , Registry <R > registry , String codeName , String languageNode , boolean registerComparator ) {
37
+ this (registryClass , registry , codeName , languageNode , new EventValueExpression <>(registryClass ), registerComparator );
21
38
}
22
39
23
40
/**
41
+ * @param registryClass The registry class
24
42
* @param registry The registry
25
43
* @param codeName The name used in patterns
44
+ * @param languageNode The language node of the type
45
+ * @param defaultExpression The default expression of the type
26
46
*/
27
47
public RegistryClassInfo (Class <R > registryClass , Registry <R > registry , String codeName , String languageNode , DefaultExpression <R > defaultExpression ) {
48
+ this (registryClass , registry , codeName , languageNode , defaultExpression , true );
49
+ }
50
+
51
+ /**
52
+ * @param registryClass The registry class
53
+ * @param registry The registry
54
+ * @param codeName The name used in patterns
55
+ * @param languageNode The language node of the type
56
+ * @param defaultExpression The default expression of the type
57
+ * @param registerComparator Whether a default comparator should be registered for this registry's classinfo
58
+ */
59
+ public RegistryClassInfo (Class <R > registryClass , Registry <R > registry , String codeName , String languageNode , DefaultExpression <R > defaultExpression , boolean registerComparator ) {
28
60
super (registryClass , codeName );
29
61
RegistryParser <R > registryParser = new RegistryParser <>(registry , languageNode );
30
62
usage (registryParser .getAllNames ())
@@ -33,7 +65,8 @@ public RegistryClassInfo(Class<R> registryClass, Registry<R> registry, String co
33
65
.defaultExpression (defaultExpression )
34
66
.parser (registryParser );
35
67
36
- Comparators .registerComparator (registryClass , registryClass , (o1 , o2 ) -> Relation .get (o1 .getKey () == o2 .getKey ()));
68
+ if (registerComparator )
69
+ Comparators .registerComparator (registryClass , registryClass , (o1 , o2 ) -> Relation .get (o1 .getKey () == o2 .getKey ()));
37
70
}
38
71
39
72
}
0 commit comments