class TypeLiteral implements Serializable {

    protected Type getDefinedType(Class<?> clazz) {
        Type type;

        if (clazz == null) {
            throw new RuntimeException("Class parameter clazz can not be null");
        }

        Type superClazz = clazz.getGenericSuperclass();

        if (superClazz instanceof ParameterizedType) {
            ParameterizedType pt = (ParameterizedType) superClazz;
            Type[] actualArgs = pt.getActualTypeArguments();

            if (actualArgs.length == 1) {
                type = actualArgs[0];

            } else {
                throw new RuntimeException("More than one parametric type");
            }

        } else if (superClazz.equals(Object.class)) {
            throw new RuntimeException("Super class must be parametrized type");
        } else {
            type = getDefinedType((Class<?>) superClazz);
        }

        return type;
    }

    public  TypeLiteral(Type definedType);
    public  TypeLiteral();

}