Unpacks the given object by recursively
calling the {@code call()} method if the
object is a {@code Closure} or {@code Callable}.
@param obj the object to unpack
@return the unpacked value of the object
486778
@SuppressWarnings("rawtypes")
    public static Object unpack(Object obj) {
        Object value = obj;
        while (value != null) {
            if (value instanceof Closure) {
                value = ((Closure) value).call();
            } else if (value instanceof Callable) {
                try {
                    value = ((Callable) value).call();
                } catch (Exception e) {
                    throw new RuntimeException(e);
                }
            } else {
                return value;
            }
        }
        return value;
    }
1247467
protected Throwable unwrap(Throwable throwable) {
        if (throwable instanceof ExecutionException && throwable.getCause() != null) {
            return throwable.getCause();
        }
        return throwable;
    }
133351
private Object itemValue(Object obj, Object item) throws NoSuchMethodException,
            ClassNotFoundException, InvocationTargetException, IllegalAccessException
    {
        // String value
        if (item instanceof String) return item;

        XmlParser.Node node = (XmlParser.Node) item;
        String tag = node.getTag();
        if ("Call".equals(tag)) return call(obj, node);
        if ("Get".equals(tag)) return get(obj, node);
        if ("New".equals(tag)) return newObj(obj, node);
        if ("Ref".equals(tag)) return refObj(obj, node);
        if ("Array".equals(tag)) return newArray(obj, node);

        if ("SystemProperty".equals(tag))
        {
            String name = node.getAttribute("name");
            String defaultValue = node.getAttribute("default");
            return System.getProperty(name, defaultValue);
        }

        log.warn("Unknown value tag: " + node, new Throwable());
        return null;
    }
1155887
function unwrapSync (x) {
  if (!x || (typeof x !== 'object' && typeof x !== 'function')) {
    return x
  }

  const then = x.then
  if (typeof then !== 'function') return x

  let state = constants.PENDING
  let value
  const unwrapValue = y => {
    if (state === constants.PENDING) {
      state = constants.RESOLVED
      value = y
    }
  }
  const unwrapReason = r => {
    if (state === constants.PENDING) {
      state = constants.REJECTED
      value = r
    }
  }
  then.call(x, unwrapValue, unwrapReason)

  if (state === constants.PENDING) {
    state = constants.ASYNC
    throw new UnwrapError(x)
  }

  if (state === constants.RESOLVED) {
    return unwrapSync(value)
  }

  // state === REJECTED
  throw value
}
586918
function (obj) {
            if (typeof obj === "undefined")
                /*  get current object  */
                return this.__obj;
            else if (typeof obj === "object") {
                /*  set new object  */
                if (obj !== null) {
                    _cs.annotation(obj, "comp", this);
                    this.__obj = obj;
                }
                else {
                    if (this.__obj !== null)
                        _cs.annotation(this.__obj, "comp", null);
                    this.__obj = null;
                }
            }
            else
                throw _cs.exception("obj", "invalid argument");
            return this;
        }
766046
public Iterable<Tuple2<String, Obj>> asKeyObjSeq(final @Nullable Obj obj) {
		return new Iterable<Tuple2<String, Obj>>() {
			@Override public Iterator<Tuple2<String, Obj>> iterator() {
				if (obj != null) {
					final Iterator<Entry<String, Object>> i = obj.iterator();
					return new Iterator<Tuple2<String, Obj>>() {
						@Override public boolean hasNext() {
							return i.hasNext();
						}
						@Override public Tuple2<String, Obj> next() {
							Entry<String, Object> entry = i.next();
							return new Tuple2<String, Obj>(entry.getKey(), (Obj) entry.getValue());
						}
						@Override public void remove() {
							Check.unsupportedoperation.fail();
						}
					};
				}
				return java.util.Collections.emptyIterator();
			}
		};
	}
911851
private static Object unwrap(Object object) {
        if (object instanceof Reflect) {
            return ((Reflect) object).get();
        }

        return object;
    }
145010
protected ISFSObject parseMethods(ClassUnwrapper unwrapper,
            Object object) {
        return object2params(unwrapper, object, new SFSObject());
        
    }
1175547
public static Object resolveUnderlyingObject(Object obj) {
    while(obj instanceof Decorator) {
      obj = ((Decorator)obj).getDecoratedObject();
    }
    return obj;
  }
914718
public static final Object getImpl(Object obj) {
        InvocationHandler handler;

        return Proxy.isProxyClass(obj.getClass()) && (handler = Proxy.getInvocationHandler(obj)) instanceof WSJdbcTracer ? ((WSJdbcTracer) handler).impl : obj;
    }
987564
public static ASN1Set getInstance(
        Object  obj)
    {
        if (obj == null || obj instanceof ASN1Set)
        {
            return (ASN1Set)obj;
        }

        throw new IllegalArgumentException("unknown object in getInstance");
    }
708208
private byte[] toBinary(Object val) {
		if(val == NULL) {
			return new byte[0];
		} else {
			if(val instanceof ObjWrapper) {
				val = ((ObjWrapper)val).unwrap();
			}
			if(val instanceof ObjWrapper) {
				val = ((ObjWrapper)val).unwrap();
			}
			return val.toString().getBytes(UTF8);
		}
	}
1171648
public static Method[] getAllMethod(Object obj) {
        if (obj == null) {
            return null;
        }
        Class<?> clazz = obj.getClass();
        try {
            return clazz.getDeclaredMethods();
        } catch (SecurityException e) {
            e.printStackTrace();
        }
        return null;
    }
637805
public Scriptable wrapNewObject(Context cx, Scriptable scope, Object obj)
    {
        if (obj instanceof Scriptable) {
            return (Scriptable)obj;
        }
        Class<?> cls = obj.getClass();
        if (cls.isArray()) {
            return NativeJavaArray.wrap(scope, obj);
        }
        return wrapAsJavaObject(cx, scope, obj, null);
    }
1095124
public static DERUTCTime getInstance(
        Object  obj)
    {
        if (obj == null || obj instanceof DERUTCTime)
        {
            return (DERUTCTime)obj;
        }

        if (obj instanceof ASN1OctetString)
        {
            return new DERUTCTime(((ASN1OctetString)obj).getOctets());
        }

        throw new IllegalArgumentException("illegal object in getInstance: " + obj.getClass().getName());
    }
405594
function makeImmutableObject(obj) {
    if (!globalConfig.use_static) {
      addPropertyTo(obj, "merge", merge);
      addPropertyTo(obj, "replace", objectReplace);
      addPropertyTo(obj, "without", without);
      addPropertyTo(obj, "asMutable", asMutableObject);
      addPropertyTo(obj, "set", objectSet);
      addPropertyTo(obj, "setIn", objectSetIn);
      addPropertyTo(obj, "update", update);
      addPropertyTo(obj, "updateIn", updateIn);
      addPropertyTo(obj, "getIn", getIn);
    }

    return makeImmutable(obj, mutatingObjectMethods);
  }
1176877
public static boolean isBlankJson(final Object obj) {
        if (obj == null) {
            return true;
        }
        if(obj instanceof Collection) {
            return (((Collection) obj).size() == 0);
        }
        if(obj instanceof Map) {
            return (((Map) obj).size() == 0);
        }
        throw new UnsupportedOperationException("map or list is supported, got ${obj?obj.getClass():null}");
    }