mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-06-25 22:09:34 +00:00
implement getType method in registries
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user