Java inferring on generic type
===

I have a class Data<T>

with a generic attribute

    private T value;

is there nicer way to do the following?  
ie returning the generic type in different forms?

    public List<String> getValues() {
    	if (value.getClass() != ArrayList.class)
    		throw new Exception("Wrong Enum value '%s'", value);
    	return (ArrayList<String>) value;
    	//ugly
    }
    
   
    public String getStringValue() {
    	if (value.getClass() != String.class)
    		throw new Exception("Wrong value type '%s'", value);
    	return (String) value;
    	//ugly
    }
    
    public Float getFloatValue() {
    	if (value.getClass() != Double.class)
    		throw new Exception("Wrong value type '%s'", value);
    	return (Float) value;
    	//ugly
    }
    
    public Long getLongValue() {
    	if (value.getClass() != Double.class)
    		throw new Exception("Wrong value type '%s'", value);
    	return (Long) value;
    	//ugly
    }

Precision, I'm using Gson as deserializer, to get a List<Data>, each Data objects can then be heterogeous  
Could also register adapters for float and long detection, but it wouldn't be faster or nicer