From 87744c600bf32e69bdde38534d71575b7f92afe8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Manuel=20Carrasco=20Mo=C3=B1ino?= Date: Thu, 4 Jul 2013 08:48:01 +0200 Subject: [PATCH] Pass the class type when getting data. Remove unused method --- .../java/com/google/gwt/query/client/GQuery.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java index fd0da027..52feaf49 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java @@ -476,13 +476,6 @@ public class GQuery implements Lazy { return engine.contains(a, b); } - /** - * Get the element data matching the key. - */ - public static Object data(Element e, String key) { - return GQuery.data(e, key, null); - } - /** * We store data in js object which has this structure: * @@ -491,6 +484,10 @@ public class GQuery implements Lazy { * @return the value stored in the element with the given name */ protected static Object data(Element element, String key, S value) { + return data(element, key, value, Object.class); + } + + private static Object data(Element element, String key, S value, Class clz) { if (dataCache == null) { windowData = JavaScriptObject.createObject().cast(); dataCache = JavaScriptObject.createObject().cast(); @@ -500,7 +497,7 @@ public class GQuery implements Lazy { int id = element.hashCode(); if (value == null) { - return dataCache.exists(id) ? dataCache.getCache(id).get(key) : null; + return dataCache.exists(id) ? dataCache.getCache(id).get(key, clz) : null; } if (!dataCache.exists(id)) { @@ -1673,7 +1670,7 @@ public class GQuery implements Lazy { */ @SuppressWarnings("unchecked") public T data(String name, Class clz) { - return isEmpty() ? null : (T) data(get(0), name, null); + return isEmpty() ? null : (T) data(get(0), name, null, clz); } /** -- 2.39.5