Java Code Examples for com.google.web.bindery.autobean.shared.AutoBeanCodex#decode()
The following examples show how to use
com.google.web.bindery.autobean.shared.AutoBeanCodex#decode() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Index.java From core with GNU Lesser General Public License v2.1 | 6 votes |
public List<Document> search(final String text) { List<Document> results = new ArrayList<Document>(); JsArray jsonResult = searchInternal(text); if (jsonResult != null) { for (int i = 0; i < jsonResult.length(); i++) { JSONObject json = new JSONObject(jsonResult.get(i)); JSONString jsonId = json.get("ref").isString(); if (jsonId != null) { long id = Long.parseLong(jsonId.stringValue()); String documentJson = localStorage.getItem(key(id)); if (documentJson != null) { AutoBean<Document> autoBean = AutoBeanCodex.decode(beanFactory, Document.class, documentJson); results.add(autoBean.as()); } } } } return results; }
Example 2
Source File: BootstrapServerStore.java From core with GNU Lesser General Public License v2.1 | 6 votes |
public List<BootstrapServer> load() { List<BootstrapServer> servers = new ArrayList<BootstrapServer>(); if (storage != null) { //noinspection MismatchedQueryAndUpdateOfCollection StorageMap storageMap = new StorageMap(storage); if (storageMap.containsKey(KEY)) { String json = storageMap.get(KEY); if (json != null) { JSONValue jsonValue = JSONParser.parseStrict(json); if (jsonValue != null) { JSONArray jsonArray = jsonValue.isArray(); if (jsonArray != null) { for (int i = 0; i < jsonArray.size(); i++) { AutoBean<BootstrapServer> bean = AutoBeanCodex .decode(factory, BootstrapServer.class, jsonArray.get(i).toString()); servers.add(bean.as()); } } } } } } return servers; }
Example 3
Source File: BootstrapServerStore.java From core with GNU Lesser General Public License v2.1 | 6 votes |
public BootstrapServer restoreSelection() { if (storage != null) { //noinspection MismatchedQueryAndUpdateOfCollection StorageMap storageMap = new StorageMap(storage); if (storageMap.containsKey(KEY)) { String json = storageMap.get(SELECTED); if (json != null) { JSONValue jsonValue = JSONParser.parseStrict(json); if (jsonValue != null) { JSONObject jsonObject = jsonValue.isObject(); if (jsonObject != null) { AutoBean<BootstrapServer> bean = AutoBeanCodex .decode(factory, BootstrapServer.class, jsonObject.toString()); return bean.as(); } } } } } return null; }
Example 4
Source File: AuditLogItemDataProvider.java From core with GNU Lesser General Public License v2.1 | 5 votes |
private AuditLogItem parseItem(final MatchResult match) { String date = match.getGroup(1); AutoBean<AuditLogItem> itemBean = AutoBeanCodex.decode(beanFactory, AuditLogItem.class, match.getGroup(2)); AuditLogItem item = itemBean.as(); item.setId(idCounter++); item.setDate(date); return item; }