com.infomaximum.cluster.graphql.utils.ReflectionUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cluster-graphql Show documentation
Show all versions of cluster-graphql Show documentation
Library for creating a light cluster
The newest version!
package com.infomaximum.cluster.graphql.utils;
import com.infomaximum.cluster.graphql.anotation.GraphQLName;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
public class ReflectionUtils {
public static Constructor getGConstructor(Class classGraphQLTypeInput) {
Constructor constructor = null;
for (Constructor iConstructor : classGraphQLTypeInput.getConstructors()) {
Annotation[][] annotations = iConstructor.getParameterAnnotations();
if (annotations.length == 0) {
continue;
}
//Ищем в у первого параметра аннотацию GraphQL
for (Annotation annotation : annotations[0]) {
if (annotation.annotationType() == GraphQLName.class) {
if (constructor == null) {
constructor = iConstructor;
break;
} else {
throw new RuntimeException("Undefined behavior, multiple constructors with GraphQLName annotation: " + classGraphQLTypeInput.getName());
}
}
}
}
return constructor;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy