Package uk.ac.starlink.util
Class WrapUtils
- java.lang.Object
-
- uk.ac.starlink.util.WrapUtils
-
public class WrapUtils extends java.lang.ObjectUtilities relating to theWrapperclass.- Since:
- 3 Apr 2008
- Author:
- Mark Taylor
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.ObjectgetWrapped(java.lang.Object obj)Returns the object on which a given object is based.static java.lang.ObjectgetWrapped(java.lang.Object obj, java.lang.Class<?> clazz)Attempts to return an object of a given class on which a given object is based.
-
-
-
Method Detail
-
getWrapped
public static java.lang.Object getWrapped(java.lang.Object obj)
Returns the object on which a given object is based. Ifobjis aWrapper, it is unwrapped as far as possible and the base object is returned. Otherwiseobjitself is returned.- Parameters:
obj- test object- Returns:
- ultimate base object of
obj
-
getWrapped
public static java.lang.Object getWrapped(java.lang.Object obj, java.lang.Class<?> clazz)Attempts to return an object of a given class on which a given object is based. An object is unwrapped (seeWrapper.getBase()) until an object of classclazzis found, at which point it is returned. If noclazzobject can be found,nullis returned.- Parameters:
obj- test object- Returns:
- object within the wrapping hierarchy of class
clazz, or null
-
-