Hi, I was thinking of creating a class that extends PrimitiveType and returns the smallest data type able to hold a given value. For instance, if the value in the database was less than 2^15, it would return a short; if it's less than 2^31, it would return an int; and so on.
Let me just say this first: I realize it might not be the best way to improve performance of an application, so let's just treat it as an academic exercise.
What are people's thoughts on this idea? Do you forsee any problems? Has anybody tried something like this? Am I a complete idiot?
|