Example usage for java.util ListIterator next

List of usage examples for java.util ListIterator next

Introduction

In this page you can find the example usage for java.util ListIterator next.

Prototype

E next();

Source Link

Document

Returns the next element in the list and advances the cursor position.

Usage

From source file:edu.harvard.mcz.imagecapture.PositionTemplate.java

public static List<PositionTemplate> getTemplates() {
    //TemplateLifeCycle tls = new TemplateLifeCycle();
    //List<Template> templates = tls.findAll();
    ArrayList<PositionTemplate> results = new ArrayList<PositionTemplate>();
    List<String> templateIds = PositionTemplate.getTemplateIds();
    ListIterator<String> i = templateIds.listIterator();
    while (i.hasNext()) {
        try {/*  www.j a  v  a  2s  .  co m*/
            results.add(new PositionTemplate(i.next()));
        } catch (NoSuchTemplateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    return results;
}

From source file:com.ppp.prm.portal.server.service.gwt.HibernateDetachUtility.java

/**
* @param value the object needing to be detached/scrubbed.
* @param checkedObjectMap This maps identityHashCodes to Objects we've already detached. In that way we can
* quickly determine if we've already done the work for the incoming value and avoid taversing it again. This
* works well almost all of the time, but it is possible that two different objects can have the same identity hash
* (conflicts are always possible with a hash). In that case we utilize the checkedObjectCollisionMap (see below).
* @param checkedObjectCollisionMap checkedObjectMap maps the identityhash to the *first* object with that hash. In
* most cases there will only be mapping for one hash, but it is possible to encounter the same hash for multiple
* objects, especially on 32bit or IBM JVMs. It is important to know if an object has already been detached
* because if it is somehow self-referencing, we have to stop the recursion. This map holds the 2nd..Nth mapping
* for a single hash and is used to ensure we never try to detach an object already processed.
* @param depth used to stop infinite recursion, defaults to a depth we don't expectto see, but it is configurable.
* @param serializationType//from   w w  w .j av  a  2  s  .c  o m
* @throws Exception if a problem occurs
* @throws IllegalStateException if the recursion depth limit is reached
*/
private static void nullOutUninitializedFields(Object value, Map<Integer, Object> checkedObjectMap,
        Map<Integer, List<Object>> checkedObjectCollisionMap, int depth, SerializationType serializationType)
        throws Exception {
    if (depth > depthAllowed) {
        String warningMessage = "Recursed too deep [" + depth + " > " + depthAllowed
                + "], will not attempt to detach object of type ["
                + ((value != null) ? value.getClass().getName() : "N/A")
                + "]. This may cause serialization errors later. "
                + "You can try to work around this by setting the system property [" + DEPTH_ALLOWED_SYSPROP
                + "] to a value higher than [" + depth + "] or you can set the system property ["
                + THROW_EXCEPTION_ON_DEPTH_LIMIT_SYSPROP + "] to 'false'";
        LOG.warn(warningMessage);
        if (throwExceptionOnDepthLimit) {
            throw new IllegalStateException(warningMessage);
        }
        return;
    }

    if (null == value) {
        return;
    }

    // System.identityHashCode is a hash code, and therefore not guaranteed to be unique. And we've seen this
    // be the case.  So, we use it to try and avoid duplicating work, but handle the case when two objects may
    // have an identity crisis.
    Integer valueIdentity = hashCodeGenerator.getHashCode(value);
    Object checkedObject = checkedObjectMap.get(valueIdentity);

    if (null == checkedObject) {
        // if we have not yet encountered an object with this hash, store it in our map and start scrubbing            
        checkedObjectMap.put(valueIdentity, value);

    } else if (value == checkedObject) {
        // if we have scrubbed this already, no more work to be done            
        return;

    } else {
        // we have a situation where multiple objects have the same identity hashcode, work with our
        // collision map to decide whether it needs to be scrubbed and add if necessary.
        // Note that this code block is infrequently hit, it is by design that we've pushed the extra
        // work, map, etc, involved for this infrequent case into its own block. The standard cases must
        // be as fast and lean as possible.

        boolean alreadyDetached = false;
        List<Object> collisionObjects = checkedObjectCollisionMap.get(valueIdentity);

        if (null == collisionObjects) {
            // if this is the 2nd occurrence for this hash, create a new map entry                
            collisionObjects = new ArrayList<Object>(1);
            checkedObjectCollisionMap.put(valueIdentity, collisionObjects);

        } else {
            // if we have scrubbed this already, no more work to be done                
            for (Object collisionObject : collisionObjects) {
                if (value == collisionObject) {
                    alreadyDetached = true;
                    break;
                }
            }
        }

        if (LOG.isDebugEnabled()) {
            StringBuilder message = new StringBuilder("\n\tIDENTITY HASHCODE COLLISION [hash=");
            message.append(valueIdentity);
            message.append(", alreadyDetached=");
            message.append(alreadyDetached);
            message.append("]");
            message.append("\n\tCurrent  : ");
            message.append(value.getClass().getName());
            message.append("\n\t    ");
            message.append(value);
            message.append("\n\tPrevious : ");
            message.append(checkedObject.getClass().getName());
            message.append("\n\t    ");
            message.append(checkedObject);
            for (Object collisionObject : collisionObjects) {
                message.append("\n\tPrevious : ");
                message.append(collisionObject.getClass().getName());
                message.append("\n\t    ");
                message.append(collisionObject);
            }

            LOG.debug(message);
        }

        // now that we've done our logging, if already detached we're done. Otherwise add to the list of collision
        // objects for this hash, and start scrubbing
        if (alreadyDetached) {
            return;
        }

        collisionObjects.add(value);
    }

    // Perform the detaching
    if (value instanceof Object[]) {
        Object[] objArray = (Object[]) value;
        for (int i = 0; i < objArray.length; i++) {
            Object listEntry = objArray[i];
            Object replaceEntry = replaceObject(listEntry);
            if (replaceEntry != null) {
                objArray[i] = replaceEntry;
            }
            nullOutUninitializedFields(objArray[i], checkedObjectMap, checkedObjectCollisionMap, depth + 1,
                    serializationType);
        }
    } else if (value instanceof List) {
        // Null out any entries in initialized collections
        ListIterator i = ((List) value).listIterator();
        while (i.hasNext()) {
            Object val = i.next();
            Object replace = replaceObject(val);
            if (replace != null) {
                val = replace;
                i.set(replace);
            }
            nullOutUninitializedFields(val, checkedObjectMap, checkedObjectCollisionMap, depth + 1,
                    serializationType);
        }

    } else if (value instanceof Collection) {
        Collection collection = (Collection) value;
        Collection itemsToBeReplaced = new ArrayList();
        Collection replacementItems = new ArrayList();
        for (Object item : collection) {
            Object replacementItem = replaceObject(item);
            if (replacementItem != null) {
                itemsToBeReplaced.add(item);
                replacementItems.add(replacementItem);
                item = replacementItem;
            }
            nullOutUninitializedFields(item, checkedObjectMap, checkedObjectCollisionMap, depth + 1,
                    serializationType);
        }
        collection.removeAll(itemsToBeReplaced);
        collection.addAll(replacementItems); // watch out! if this collection is a Set, HashMap$MapSet doesn't support addAll. See BZ 688000
    } else if (value instanceof Map) {
        Map originalMap = (Map) value;
        HashMap<Object, Object> replaceMap = new HashMap<Object, Object>();
        for (Iterator i = originalMap.keySet().iterator(); i.hasNext();) {
            // get original key and value - these might be hibernate proxies
            Object originalKey = i.next();
            Object originalKeyValue = originalMap.get(originalKey);

            // replace with non-hibernate classes, if appropriate (will be null otherwise)
            Object replaceKey = replaceObject(originalKey);
            Object replaceValue = replaceObject(originalKeyValue);

            // if either original key or original value was a hibernate proxy object, we have to 
            // remove it from the original map, and remember the replacement objects for later
            if (replaceKey != null || replaceValue != null) {
                Object newKey = (replaceKey != null) ? replaceKey : originalKey;
                Object newValue = (replaceValue != null) ? replaceValue : originalKeyValue;
                replaceMap.put(newKey, newValue);
                i.remove();
            }
        }

        // all hibernate proxies have been removed, we need to replace them with their
        // non-proxy object representations that we got from replaceObject() calls
        originalMap.putAll(replaceMap);

        // now go through each item in the map and null out their internal fields
        for (Object key : originalMap.keySet()) {
            nullOutUninitializedFields(originalMap.get(key), checkedObjectMap, checkedObjectCollisionMap,
                    depth + 1, serializationType);
            nullOutUninitializedFields(key, checkedObjectMap, checkedObjectCollisionMap, depth + 1,
                    serializationType);
        }
    } else if (value instanceof Enum) {
        // don't need to detach enums, treat them as special objects
        return;
    }

    if (serializationType == SerializationType.JAXB) {
        XmlAccessorType at = value.getClass().getAnnotation(XmlAccessorType.class);
        if (at != null && at.value() == XmlAccessType.FIELD) {
            nullOutFieldsByFieldAccess(value, checkedObjectMap, checkedObjectCollisionMap, depth,
                    serializationType);
        } else {
            nullOutFieldsByAccessors(value, checkedObjectMap, checkedObjectCollisionMap, depth,
                    serializationType);
        }
    } else if (serializationType == SerializationType.SERIALIZATION) {
        nullOutFieldsByFieldAccess(value, checkedObjectMap, checkedObjectCollisionMap, depth,
                serializationType);
    }

}

From source file:ch.flashcard.HibernateDetachUtility.java

/**
 * @param value the object needing to be detached/scrubbed.
 * @param checkedObjectMap This maps identityHashCodes to Objects we've already detached. In that way we can
 * quickly determine if we've already done the work for the incoming value and avoid taversing it again. This
 * works well almost all of the time, but it is possible that two different objects can have the same identity hash
 * (conflicts are always possible with a hash). In that case we utilize the checkedObjectCollisionMap (see below).
 * @param checkedObjectCollisionMap checkedObjectMap maps the identityhash to the *first* object with that hash. In
 * most cases there will only be mapping for one hash, but it is possible to encounter the same hash for multiple
 * objects, especially on 32bit or IBM JVMs. It is important to know if an object has already been detached
 * because if it is somehow self-referencing, we have to stop the recursion. This map holds the 2nd..Nth mapping
 * for a single hash and is used to ensure we never try to detach an object already processed.
 * @param depth used to stop infinite recursion, defaults to a depth we don't expectto see, but it is configurable.
 * @param serializationType/*from w w  w  . ja  v a  2  s.c  o m*/
 * @throws Exception if a problem occurs
 * @throws IllegalStateException if the recursion depth limit is reached
 */
private static void nullOutUninitializedFields(Object value, Map<Integer, Object> checkedObjectMap,
        Map<Integer, List<Object>> checkedObjectCollisionMap, int depth, SerializationType serializationType)
        throws Exception {
    if (depth > depthAllowed) {
        String warningMessage = "Recursed too deep [" + depth + " > " + depthAllowed
                + "], will not attempt to detach object of type ["
                + ((value != null) ? value.getClass().getName() : "N/A")
                + "]. This may cause serialization errors later. "
                + "You can try to work around this by setting the system property [" + DEPTH_ALLOWED_SYSPROP
                + "] to a value higher than [" + depth + "] or you can set the system property ["
                + THROW_EXCEPTION_ON_DEPTH_LIMIT_SYSPROP + "] to 'false'";
        LOG.warn(warningMessage);
        if (throwExceptionOnDepthLimit) {
            throw new IllegalStateException(warningMessage);
        }
        return;
    }

    if (null == value) {
        return;
    }

    // System.identityHashCode is a hash code, and therefore not guaranteed to be unique. And we've seen this
    // be the case.  So, we use it to try and avoid duplicating work, but handle the case when two objects may
    // have an identity crisis.
    Integer valueIdentity = hashCodeGenerator.getHashCode(value);
    Object checkedObject = checkedObjectMap.get(valueIdentity);

    if (null == checkedObject) {
        // if we have not yet encountered an object with this hash, store it in our map and start scrubbing            
        checkedObjectMap.put(valueIdentity, value);

    } else if (value == checkedObject) {
        // if we have scrubbed this already, no more work to be done            
        return;

    } else {
        // we have a situation where multiple objects have the same identity hashcode, work with our
        // collision map to decide whether it needs to be scrubbed and add if necessary.
        // Note that this code block is infrequently hit, it is by design that we've pushed the extra
        // work, map, etc, involved for this infrequent case into its own block. The standard cases must
        // be as fast and lean as possible.

        boolean alreadyDetached = false;
        List<Object> collisionObjects = checkedObjectCollisionMap.get(valueIdentity);

        if (null == collisionObjects) {
            // if this is the 2nd occurrence for this hash, create a new map entry                
            collisionObjects = new ArrayList<Object>(1);
            checkedObjectCollisionMap.put(valueIdentity, collisionObjects);

        } else {
            // if we have scrubbed this already, no more work to be done                
            for (Object collisionObject : collisionObjects) {
                if (value == collisionObject) {
                    alreadyDetached = true;
                    break;
                }
            }
        }

        if (LOG.isDebugEnabled()) {
            StringBuilder message = new StringBuilder("\n\tIDENTITY HASHCODE COLLISION [hash=");
            message.append(valueIdentity);
            message.append(", alreadyDetached=");
            message.append(alreadyDetached);
            message.append("]");
            message.append("\n\tCurrent  : ");
            message.append(value.getClass().getName());
            message.append("\n\t    ");
            message.append(value);
            message.append("\n\tPrevious : ");
            message.append(checkedObject.getClass().getName());
            message.append("\n\t    ");
            message.append(checkedObject);
            for (Object collisionObject : collisionObjects) {
                message.append("\n\tPrevious : ");
                message.append(collisionObject.getClass().getName());
                message.append("\n\t    ");
                message.append(collisionObject);
            }

            LOG.debug(message);
        }

        // now that we've done our logging, if already detached we're done. Otherwise add to the list of collision
        // objects for this hash, and start scrubbing
        if (alreadyDetached) {
            return;
        }

        collisionObjects.add(value);
    }

    // Perform the detaching
    if (value instanceof Object[]) {
        Object[] objArray = (Object[]) value;
        for (int i = 0; i < objArray.length; i++) {
            Object listEntry = objArray[i];
            Object replaceEntry = replaceObject(listEntry);
            if (replaceEntry != null) {
                objArray[i] = replaceEntry;
            }
            nullOutUninitializedFields(objArray[i], checkedObjectMap, checkedObjectCollisionMap, depth + 1,
                    serializationType);
        }
    } else if (value instanceof List) {
        // Null out any entries in initialized collections
        ListIterator i = ((List) value).listIterator();
        while (i.hasNext()) {
            Object val = i.next();
            Object replace = replaceObject(val);
            if (replace != null) {
                val = replace;
                i.set(replace);
            }
            nullOutUninitializedFields(val, checkedObjectMap, checkedObjectCollisionMap, depth + 1,
                    serializationType);
        }

    } else if (value instanceof Collection) {
        Collection collection = (Collection) value;
        Collection itemsToBeReplaced = new ArrayList();
        Collection replacementItems = new ArrayList();
        for (Object item : collection) {
            Object replacementItem = replaceObject(item);
            if (replacementItem != null) {
                itemsToBeReplaced.add(item);
                replacementItems.add(replacementItem);
                item = replacementItem;
            }
            nullOutUninitializedFields(item, checkedObjectMap, checkedObjectCollisionMap, depth + 1,
                    serializationType);
        }
        collection.removeAll(itemsToBeReplaced);
        collection.addAll(replacementItems); // watch out! if this collection is a Set, HashMap$MapSet doesn't support addAll. See BZ 688000
    } else if (value instanceof Map) {
        Map originalMap = (Map) value;
        HashMap<Object, Object> replaceMap = new HashMap<Object, Object>();
        for (Iterator i = originalMap.keySet().iterator(); i.hasNext();) {
            // get original key and value - these might be hibernate proxies
            Object originalKey = i.next();
            Object originalKeyValue = originalMap.get(originalKey);

            // replace with non-hibernate classes, if appropriate (will be null otherwise)
            Object replaceKey = replaceObject(originalKey);
            Object replaceValue = replaceObject(originalKeyValue);

            // if either original key or original value was a hibernate proxy object, we have to 
            // remove it from the original map, and remember the replacement objects for later
            if (replaceKey != null || replaceValue != null) {
                Object newKey = (replaceKey != null) ? replaceKey : originalKey;
                Object newValue = (replaceValue != null) ? replaceValue : originalKeyValue;
                replaceMap.put(newKey, newValue);
                i.remove();
            }
        }

        // all hibernate proxies have been removed, we need to replace them with their
        // non-proxy object representations that we got from replaceObject() calls
        originalMap.putAll(replaceMap);

        // now go through each item in the map and null out their internal fields
        for (Object key : originalMap.keySet()) {
            nullOutUninitializedFields(originalMap.get(key), checkedObjectMap, checkedObjectCollisionMap,
                    depth + 1, serializationType);
            nullOutUninitializedFields(key, checkedObjectMap, checkedObjectCollisionMap, depth + 1,
                    serializationType);
        }
    } else if (value instanceof Enum) {
        // don't need to detach enums, treat them as special objects
        return;
    }

    if (serializationType == SerializationType.JAXB) {
        XmlAccessorType at = (XmlAccessorType) value.getClass().getAnnotation(XmlAccessorType.class);
        if (at != null && at.value() == XmlAccessType.FIELD) {
            nullOutFieldsByFieldAccess(value, checkedObjectMap, checkedObjectCollisionMap, depth,
                    serializationType);
        } else {
            nullOutFieldsByAccessors(value, checkedObjectMap, checkedObjectCollisionMap, depth,
                    serializationType);
        }
    } else if (serializationType == SerializationType.SERIALIZATION) {
        nullOutFieldsByFieldAccess(value, checkedObjectMap, checkedObjectCollisionMap, depth,
                serializationType);
    }

}

From source file:net.firstpartners.nounit.utility.XmlUtil.java

/**
 * gets all elements in the XML Document Being Passed in <BR>
 * @param inXmlDocument to generated the hashmap from
 * @return nodeList containing nodes/* w w  w . j  av  a 2  s.  c  om*/
 */
public static HashSet getAllNodes(Document inXmlDocument) {

    //Internal Variables
    int stackPointer = 0;
    int index = 1;
    String locationId = null;
    Element currentElement = null;
    Element parentElement = null;
    Element thisElement = null;
    Attribute tmpAttribute = null;
    List elementList = null;
    ListIterator deepestList = null;

    HashMap mappings = new HashMap();
    HashSet nodeList = new HashSet();
    List stack = new Vector(); //Implements list interface

    //Get the list information for the entire document - kick start loop
    stack.add(inXmlDocument.getContent().listIterator());

    //Loop though the elements on list
    while (!stack.isEmpty()) {

        //Get the last list on the stack
        deepestList = (ListIterator) stack.get(stack.size() - 1);

        //Does this list have more elements?
        if (deepestList.hasNext()) {

            //if so Get Next element from this list
            thisElement = (Element) deepestList.next();

            // add this element to the list
            nodeList.add(thisElement);

            //does this list have children ?
            if (thisElement.hasChildren()) {

                //if so add to the stack
                stackPointer++;
                stack.add(thisElement.getChildren().listIterator());
            }
        } else {
            //if not , remove this list from the stack
            stack.remove(stackPointer);
            stackPointer--;

        } // end if stack has more elements

    }

    return nodeList;
}

From source file:com.qualogy.qafe.core.errorhandling.ErrorProcessor.java

private static void goBackToItemPosition(ListIterator<? extends Item> itrItem, Item targetItem,
        ApplicationContext context, Window window) {
    if (itrItem != null) {
        boolean found = false;
        while (itrItem.hasPrevious()) {
            Item item = itrItem.previous();
            if (item == targetItem) {
                found = true;/*from   w w  w . ja  v  a  2s. c  o m*/
            } else if (item instanceof EventRef) {
                found = containsItem((EventRef) item, targetItem, context, window);
            }
            if (found) {
                itrItem.next();
                break;
            }
        }
    }
}

From source file:edu.umd.cfar.lamp.viper.geometry.BoundingBox.java

/**
 * Gets a set of boxes which covers all and only the pixels covered by
 * <code>A</code> and <code>B</code>.
 * /*  w  w  w.j  av  a 2  s . com*/
 * @param A
 *            a set of boxes to union with
 * @param B
 *            a set of boxes to union with
 * @return a set of boxes corresponding to the region shared by A and B
 */
public static BoundingBox union(BoundingBox A, BoundingBox B) {
    BoundingBox temp = new BoundingBox();
    LinkedList aList;
    temp.composed = true;
    int x = Math.min(A.rect.x, B.rect.x);
    int y = Math.min(A.rect.y, B.rect.y);
    int x2 = Math.max(A.rect.x + A.rect.width, B.rect.x + B.rect.width);
    int y2 = Math.max(A.rect.y + A.rect.height, B.rect.y + B.rect.height);

    temp.rect = new Rectangle(x, y, x2, y2);

    if (A.composed)
        aList = (LinkedList) A.pieces.clone();
    else {
        aList = new LinkedList();
        aList.add(A);
    }

    if (B.composed)
        temp = B.copy();
    else {
        temp.pieces = new LinkedList();
        temp.pieces.add(B.copy());
        temp.composed = true;
    }

    ListIterator iter = aList.listIterator(0);
    while (iter.hasNext()) {
        BoundingBox child = (BoundingBox) iter.next();
        Iterator ti = temp.pieces.iterator();
        LinkedList childRemains = null;

        /* remove an offending piece of the child */
        while (ti.hasNext() && (null == (childRemains = ((BoundingBox) ti.next()).subtractFrom(child))))
            ;

        /*
         * Add the broken pieces into the list and break back to top loop
         * remove the offending rectangle and replace it with its shards,
         * then clean up those.
         */
        if (childRemains != null) {
            ti = childRemains.iterator();
            iter.remove();
            while (ti.hasNext()) {
                iter.add(ti.next());
                iter.previous();
            }
        }
    }
    temp.pieces.addAll(aList);
    temp.simplify();
    return (temp);
}

From source file:jenkins.scm.impl.subversion.SubversionSCMSource.java

/**
 * Returns the index of the next wildcard segment on or after the specified start index.
 *
 * @param pathSegment the path segments.
 * @param startIndex  the first index to check.
 * @return the index with a wildcard or {@code -1} if none exist.
 *//*  w w w  .  j  a va2s. com*/
static int indexOfNextWildcard(@NonNull List<String> pathSegment, int startIndex) {
    int index = startIndex;
    ListIterator<String> i = pathSegment.listIterator(index);
    while (i.hasNext()) {
        String segment = i.next();
        if (segment.indexOf('*') != -1 || segment.indexOf('?') != -1) {
            break;
        }
        index++;
    }
    return index;
}

From source file:jenkins.scm.impl.subversion.SubversionSCMSource.java

/**
 * Returns {@code true} if and only if the value starts with the supplied prefix.
 *
 * @param value  the value./*from w w  w .jav  a2 s. c  om*/
 * @param prefix the candidate prefix.
 * @return {@code true} if and only if the value starts with the supplied prefix.
 */
static boolean startsWith(@NonNull List<String> value, @NonNull List<String> prefix) {
    if (value.size() < prefix.size()) {
        return false;
    }
    ListIterator<String> i1 = value.listIterator();
    ListIterator<String> i2 = prefix.listIterator();
    while (i1.hasNext() && i2.hasNext()) {
        if (!i1.next().equals(i2.next())) {
            return false;
        }
    }
    return true;
}

From source file:jenkins.scm.impl.subversion.SubversionSCMSource.java

/**
 * Returns {@code true} if and only if the value starts with the supplied prefix.
 *
 * @param value          the value./*from  ww w . j  a v  a 2s .  c om*/
 * @param wildcardPrefix the candidate prefix.
 * @return {@code true} if and only if the value starts with the supplied prefix.
 */
static boolean wildcardStartsWith(@NonNull List<String> value, @NonNull List<String> wildcardPrefix) {
    if (value.size() < wildcardPrefix.size()) {
        return false;
    }
    ListIterator<String> i1 = value.listIterator();
    ListIterator<String> i2 = wildcardPrefix.listIterator();
    while (i1.hasNext() && i2.hasNext()) {
        if (!isMatch(i1.next(), i2.next())) {
            return false;
        }
    }
    return true;
}

From source file:org.apache.gobblin.salesforce.SalesforceExtractor.java

private static String buildUrl(String path, List<NameValuePair> qparams) throws RestApiClientException {
    URIBuilder builder = new URIBuilder();
    builder.setPath(path);//from   w  w w .  java  2s  . c o m
    ListIterator<NameValuePair> i = qparams.listIterator();
    while (i.hasNext()) {
        NameValuePair keyValue = i.next();
        builder.setParameter(keyValue.getName(), keyValue.getValue());
    }
    URI uri;
    try {
        uri = builder.build();
    } catch (Exception e) {
        throw new RestApiClientException("Failed to build url; error - " + e.getMessage(), e);
    }
    return new HttpGet(uri).getURI().toString();
}