Package org.apache.wicket.core.util.lang
Class WicketObjects
- java.lang.Object
-
- org.apache.wicket.core.util.lang.WicketObjects
-
public class WicketObjects extends java.lang.ObjectObject (de)serialization utilities.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceWicketObjects.IObjectSizeOfStrategyInterface that enables users to plugin the way object sizes are calculated with Wicket.static classWicketObjects.SerializingObjectSizeOfStrategyWicketObjects.IObjectSizeOfStrategythat works by serializing the object to an instance ofByteCountingOutputStream, which records the number of bytes written to it.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> TcloneObject(T object)Makes a deep clone of an object by serializing and deserializing it.static <T> TnewInstance(java.lang.String className)Creates a new instance using the current application's class resolver.static <T> java.lang.Class<T>resolveClass(java.lang.String className)static voidsetObjectSizeOfStrategy(WicketObjects.IObjectSizeOfStrategy objectSizeOfStrategy)Sets the strategy for determining the sizes of objects.static longsizeof(java.io.Serializable object)Computes the size of an object.
-
-
-
Method Detail
-
resolveClass
public static <T> java.lang.Class<T> resolveClass(java.lang.String className)
- Type Parameters:
T- class type- Parameters:
className- Class to resolve- Returns:
- Resolved class
-
cloneObject
public static <T> T cloneObject(T object)
Makes a deep clone of an object by serializing and deserializing it. The object must be fully serializable to be cloned. No extra debug info is gathered.- Parameters:
object- The object to clone- Returns:
- A deep copy of the object
- See Also:
#cloneModel(Object)
-
newInstance
public static <T> T newInstance(java.lang.String className)
Creates a new instance using the current application's class resolver. Returns null if className is null.- Parameters:
className- The full class name- Returns:
- The new object instance
-
setObjectSizeOfStrategy
public static void setObjectSizeOfStrategy(WicketObjects.IObjectSizeOfStrategy objectSizeOfStrategy)
Sets the strategy for determining the sizes of objects.- Parameters:
objectSizeOfStrategy- the strategy. Pass null to reset to the default.
-
sizeof
public static long sizeof(java.io.Serializable object)
Computes the size of an object. Note that this is an estimation, never an absolute accurate size.- Parameters:
object- Object to compute size of- Returns:
- The size of the object in bytes
-
-