com.github.uuidcode.util.GenericOf Maven / Gradle / Ivy
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