implement getType method in registries

This commit is contained in:
dfsek
2021-12-19 17:41:04 -07:00
parent aeb0372d59
commit 9872d22c06
15 changed files with 260 additions and 46 deletions
@@ -7,6 +7,8 @@
package com.dfsek.terra.api.util.reflection;
import com.dfsek.tectonic.util.ClassAnnotatedTypeImpl;
import java.lang.reflect.AnnotatedParameterizedType;
import java.lang.reflect.AnnotatedType;
import java.lang.reflect.GenericArrayType;
@@ -33,6 +35,17 @@ public class TypeKey<T> {
this.hashCode = type.hashCode();
}
protected TypeKey(Class<T> clazz) {
this.type = clazz;
this.rawType = clazz;
this.annotatedType = new ClassAnnotatedTypeImpl(clazz);
this.hashCode = type.hashCode();
}
public static <T> TypeKey<T> of(Class<T> clazz) {
return new TypeKey<>(clazz);
}
public static boolean equals(Type a, Type b) {
if(a == b) {
return true;