@Override public Boolean call() throws Exception { WebElement one = getElement(); WebElement two = getKnownElements().get(otherId); // Unwrap the elements, if necessary if (one instanceof WrapsElement) { one = ((WrapsElement) one).getWrappedElement(); } if (two instanceof KnownElements.ProxiedElement) { two = ((KnownElements.ProxiedElement) two).getWrappedElement(); } return one.equals(two); }
public Object apply(Object arg) { if (arg instanceof Map) { @SuppressWarnings("unchecked") Map<String, Object> paramAsMap = (Map<String, Object>) arg; if (paramAsMap.containsKey("ELEMENT")) { KnownElements.ProxiedElement element = (KnownElements.ProxiedElement) knownElements .get((String) paramAsMap.get("ELEMENT")); return element.getWrappedElement(); } Map<String, Object> converted = Maps.newHashMapWithExpectedSize(paramAsMap.size()); for (Map.Entry<String, Object> entry : paramAsMap.entrySet()) { converted.put(entry.getKey(), apply(entry.getValue())); } return converted; } if (arg instanceof List<?>) { return Lists.newArrayList(Iterables.transform((List<?>) arg, this)); } return arg; }
public ResultConverter(KnownElements knownElements) { this.knownElements = knownElements; }
public ArgumentConverter(KnownElements knownElements) { this.knownElements = knownElements; }
protected KnownElements getKnownElements() { return getSession().getKnownElements(); }