All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.minijax.validator.metadata.ReflectionUtils Maven / Gradle / Ivy

There is a newer version: 0.3.20
Show newest version
package org.minijax.validator.metadata;

import java.lang.reflect.AnnotatedType;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

import javax.validation.ValidationException;

public class ReflectionUtils {

    ReflectionUtils() {
        throw new UnsupportedOperationException();
    }

    public static Class getRawType(final AnnotatedType annotatedType) {
        final Type containerType = annotatedType.getType();
        if (containerType instanceof Class) {
            return (Class) containerType;
        } else if (containerType instanceof ParameterizedType) {
            return (Class) ((ParameterizedType) containerType).getRawType();
        } else {
            throw new ValidationException("Unknown type: " + containerType.getClass());
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy