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

com.github.uuidcode.util.GenericOf Maven / Gradle / Ivy

There is a newer version: 0.0.64
Show newest version
package com.github.uuidcode.util;

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

/**
 * http://stackoverflow.com/questions/14139437/java-type-generic-as-argument-for-gson
 */
public class GenericOf implements ParameterizedType {
    private final Class container;
    private final Class wrapped;

    public GenericOf(Class container, Class wrapped) {
        this.container = container;
        this.wrapped = wrapped;
    }

    public Type[] getActualTypeArguments() {
        return new Type[] {
            wrapped
        };
    }

    public Type getRawType() {
        return container;
    }

    public Type getOwnerType() {
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy