Java AtomicBoolean resolveArgReferences(Object arg)

Here you can find the source of resolveArgReferences(Object arg)

Description

resolve Arg References

License

Open Source License

Declaration

public static Object resolveArgReferences(Object arg) 

Method Source Code

//package com.java2s;
/*//from  ww  w.  j a  v  a 2s  .  c  o  m
 * Copyright 2015, Yahoo Inc.
 * Copyrights licensed under the Apache 2.0 License.
 * See the accompanying LICENSE file for terms.
 */

import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;

public class Main {
    public static Object resolveArgReferences(Object arg) {
        boolean resolved = false;
        while (!resolved) {
            if (arg instanceof AtomicReference) {
                arg = ((AtomicReference<?>) arg).get();
            } else if (arg instanceof AtomicBoolean) { // Not a subclass of Number so DatabaseUtils won't handle it
                arg = ((AtomicBoolean) arg).get() ? 1 : 0;
                resolved = true;
            } else if (arg instanceof ThreadLocal) {
                arg = ((ThreadLocal<?>) arg).get();
            } else {
                resolved = true;
            }
        }
        return arg;
    }
}

Related

  1. isBoolean(Class returnType)
  2. isCaseSensitive()
  3. isComplexAddressHandlingEnabled()
  4. isWriteRelativeUris()
  5. remove()
  6. sleepCheck(int timeout, AtomicBoolean flag)
  7. waitForDelayedDrainNotify(AtomicBoolean drainNotifier)