Package com.complexible.common.base
Class SizeFunctions
- java.lang.Object
-
- com.complexible.common.base.SizeFunctions
-
public final class SizeFunctions extends java.lang.Object
Implementation of size computation for commonly used object types. The result will typically be an approximation rather than an exact amount. Speed is more important than accuracy since this utility is primarily used to adjust the number of elements in a cache.- Version:
- 2.0
- Author:
- Evren Sirin
-
-
Field Summary
Fields Modifier and Type Field Description static int
ARRAY_OVERHEAD
static SizeFunction<java.lang.Long>
LONG
static SizeFunction<java.lang.Number>
NUMBER
WARNING: checks only for Long and Integer instances! Everything that is not a Long will be sized as if it is an Integer.static int
OBJECT_OVERHEAD
static int
REF_OVERHEAD
static SizeFunction<java.lang.String>
STRING
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> SizeFunction<T>
constantSize(int size)
-
-
-
Field Detail
-
OBJECT_OVERHEAD
public static final int OBJECT_OVERHEAD
- See Also:
- Constant Field Values
-
REF_OVERHEAD
public static final int REF_OVERHEAD
- See Also:
- Constant Field Values
-
ARRAY_OVERHEAD
public static final int ARRAY_OVERHEAD
- See Also:
- Constant Field Values
-
STRING
public static final SizeFunction<java.lang.String> STRING
-
NUMBER
public static final SizeFunction<java.lang.Number> NUMBER
WARNING: checks only for Long and Integer instances! Everything that is not a Long will be sized as if it is an Integer.
-
LONG
public static final SizeFunction<java.lang.Long> LONG
-
-
Method Detail
-
constantSize
public static <T> SizeFunction<T> constantSize(int size)
-
-