Package io.github.connellite.jcl
Class JclUtils
- java.lang.Object
-
- io.github.connellite.jcl.JclUtils
-
public class JclUtils extends Object
This class has some important utility methods commonly required when using JCL- Author:
- Kamran
-
-
Constructor Summary
Constructors Constructor Description JclUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static <T> Tcast(Object object, Class<T> clazz)Casts the object ref to the passed interface class ref and returns itstatic <T> Tcast(Object object, Class<T> clazz, ClassLoader cl)Casts the object ref to the passed interface class ref and returns itstatic Objectclone(Object original)Deprecated.As of release 2.0, replaced bydeepClone(Object original)static ObjectcreateProxy(Object object, Class<?> superClass, Class<?>[] interfaces, ClassLoader cl)static ObjectdeepClone(Object original)Deep clones any objectstatic ObjectshallowClone(Object original)Shallow clones any objectstatic ObjecttoCastable(Object object, Class<?> clazz)Casts the object ref to the passed interface class ref.static ObjecttoCastable(Object object, Class<?>[] clazz)Casts the object ref to the passed interface class ref.static ObjecttoCastable(Object object, Class<?>[] clazz, ClassLoader cl)Casts the object ref to the passed interface class refstatic ObjecttoCastable(Object object, Class<?> clazz, ClassLoader cl)Casts the object ref to the passed interface class ref
-
-
-
Method Detail
-
createProxy
public static Object createProxy(Object object, Class<?> superClass, Class<?>[] interfaces, ClassLoader cl)
-
toCastable
public static Object toCastable(Object object, Class<?> clazz)
Casts the object ref to the passed interface class ref. It actually returns a dynamic proxy for the passed object- Parameters:
object-clazz-- Returns:
- castable
-
toCastable
public static Object toCastable(Object object, Class<?>[] clazz)
Casts the object ref to the passed interface class ref. It actually returns a dynamic proxy for the passed object- Parameters:
object-clazz- []- Returns:
- castable
-
toCastable
public static Object toCastable(Object object, Class<?> clazz, ClassLoader cl)
Casts the object ref to the passed interface class ref- Parameters:
object-clazz-cl-- Returns:
- castable
-
toCastable
public static Object toCastable(Object object, Class<?>[] clazz, ClassLoader cl)
Casts the object ref to the passed interface class ref- Parameters:
object-clazz- []cl-- Returns:
- castable
-
cast
public static <T> T cast(Object object, Class<T> clazz)
Casts the object ref to the passed interface class ref and returns it- Parameters:
object-clazz-- Returns:
- T reference
-
cast
public static <T> T cast(Object object, Class<T> clazz, ClassLoader cl)
Casts the object ref to the passed interface class ref and returns it- Parameters:
object-clazz-cl-- Returns:
- T reference
-
clone
@Deprecated public static Object clone(Object original)
Deprecated.As of release 2.0, replaced bydeepClone(Object original)Deep clones the Serializable objects in the current classloader. This method is slow and uses Object streams to clone Serializable objects. This method is now deprecated because of its inefficiency and the limitation to clone Serializable objects only. The use of deepClone or shallowClone is now recommended- Parameters:
original-- Returns:
- clone
-
deepClone
public static Object deepClone(Object original)
Deep clones any object- Parameters:
original-- Returns:
- clone
-
-