Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package io.appium.java_client.internal;
 
 
 import java.util.Map;
 
Reconstitutes org.openqa.selenium.WebElements from their JSON representation. Will recursively convert Lists and Maps to catch nested references. All other values pass through the converter unchanged.
		super(driver);
		this. = driver;
	}
	public Object apply(Object result) {
		if (result instanceof Collection<?>) {
			Collection<?> results = (Collection<?>) result;
			return Lists.newArrayList(Iterables.transform(resultsthis));
		}
		if (result instanceof Map<?, ?>) {
			Map<?, ?> resultAsMap = (Map<?, ?>) result;
			if (resultAsMap.containsKey("ELEMENT")) {
				element.setId(String.valueOf(resultAsMap.get("ELEMENT")));
				return element;
else {
				return Maps.transformValues(resultAsMapthis);
			}
		}
		if (result instanceof Number) {
			if (result instanceof Float || result instanceof Double) {
				return ((Numberresult).doubleValue();
			}
			return ((Numberresult).longValue();
		}
		return result;
	}
		MobileElement toReturn = new MobileElement();
		toReturn.setParent();
		return toReturn;
	}
New to GrepCode? Check out our FAQ X