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

com.clearbit.TypeRef Maven / Gradle / Ivy

There is a newer version: 0.9
Show newest version
package com.clearbit;

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

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-09-22T18:42:36.139-07:00")
public class TypeRef {
    private final Type type;

    public TypeRef() {
        this.type = getGenericType(getClass());
    }

    private static Type getGenericType(Class klass) {
        Type superclass = klass.getGenericSuperclass();
        if (superclass instanceof Class) {
            throw new RuntimeException("No type parameter provided");
        }
        ParameterizedType parameterized = (ParameterizedType) superclass;
        return parameterized.getActualTypeArguments()[0];
    }

    public Type getType() {
        return type;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy