List of usage examples for java.lang Long Long
@Deprecated(since = "9") public Long(String s) throws NumberFormatException
From source file:fr.keemto.provider.twitter.TwitterFetcherTest.java
private Tweet createTweet(String message, long creationDate) { return new Tweet(1, message, new Date(creationDate), "mypseudo", "profileImageUrl", new Long(2), 2, "FR", "source"); }
From source file:reviewbot.controllers.BookController.java
@RequestMapping(value = "/readBook", method = RequestMethod.GET, produces = "application/json") public BookDTO readBook(@RequestParam(value = "id", defaultValue = "0") String idStr) { if (idStr == null) { return new BookDTO(); }// ww w. j a v a 2 s . c om return _bookService.readOne(new Long(Long.parseLong(idStr))); }
From source file:net.sf.sail.webapp.dao.sds.impl.SdsWorkgroupCreateCommandHttpRestImpl.java
/** * @see net.sf.sail.webapp.dao.sds.SdsCommand#execute(net.sf.sail.webapp.domain.webservice.http.AbstractHttpRequest) *///w ww .j av a2 s . com public SdsWorkgroup execute(final HttpPostRequest httpRequest) { final Map<String, String> responseHeaders = this.transport.post(httpRequest); final String locationHeader = responseHeaders.get("Location"); SdsWorkgroup workgroup = this.getWorkgroup(); workgroup.setSdsObjectId(new Long(locationHeader.substring(locationHeader.lastIndexOf("/") + 1))); // release the thread local reference to the actual object to prevent // resource leak problem this.setSdsWorkgroup(null); return workgroup; }
From source file:com.fusesource.forge.jmstest.executor.AbstractBenchmarkPostProcessor.java
private void gatherStats() { startTime = new MinimizingProbe(); endTime = new MaximizingProbe(); valueCount = new Long(0); distinctProbes = new TreeMap<String, ProbeDescriptor>(); for (SampleIterator si = new SampleIterator(getWorkDir()); si.hasNext();) { BenchmarkProbeValue value = si.next(); startTime.addValue(value.getTimestamp()); endTime.addValue(value.getTimestamp()); valueCount++;/*from ww w. ja v a2s. com*/ if (!distinctProbes.containsKey(value.getDescriptor().getName())) { distinctProbes.put(value.getDescriptor().getName(), value.getDescriptor()); } } long start = startTime.getValue().longValue(); long end = endTime.getValue().longValue(); log().debug("Found " + valueCount + " BenchmarkProbes"); log().debug("StartTime: " + start); log().debug("EndTime: " + end); log().debug("Duration : " + (end - start) + "s"); }
From source file:io.s4.comm.util.JSONUtil.java
public static Object fixValue(Object originalValue) { Object value = null;// w w w. j av a2 s . co m if (originalValue instanceof Float) { value = new Double((Float) originalValue); } else if (originalValue instanceof Integer) { value = new Long((Integer) originalValue); } else if (originalValue instanceof JSONArray) { value = getRawList((JSONArray) originalValue); } else if (originalValue instanceof JSONObject) { value = getRawRecord((JSONObject) originalValue); } else { value = originalValue; } return value; }
From source file:com.glweb.module.forum.provider.hibernate.dao.MessageDAOImpl.java
public Message getMessage(long messageId) throws GLWebPersistenceException { Session _session = null;//from w w w. ja v a 2 s .co m try { _session = HibernateUtil.retrieveDefaultSession(); return (Message) _session.load(Message.class, new Long(messageId)); } catch (ObjectNotFoundException onfe) { return null; } catch (HibernateException he) { throw new GLWebPersistenceException(he); } finally { HibernateUtil.commitCloseSession(_session); } }
From source file:com.opensymphony.webwork.util.Counter.java
public Object next() { return new Long(getNext()); }
From source file:Main.java
/** * Casts an object to the specified type * * @param var/*ww w. j av a2 s.c om*/ * @param type * */ static Object convert(Object var, Class type) { if (var instanceof Number) { //use number conversion Number newNum = (Number) var; if (type == Integer.class) { return new Integer(newNum.intValue()); } else if (type == Long.class) { return new Long(newNum.longValue()); } else if (type == Float.class) { return new Float(newNum.floatValue()); } else if (type == Double.class) { return new Double(newNum.doubleValue()); } else if (type == String.class) { return new String(newNum.toString()); } } else { //direct cast if (type == Integer.class) { return new Integer(((Integer) var).intValue()); } else if (type == Long.class) { return new Long(((Long) var).longValue()); } else if (type == Float.class) { return new Float(((Float) var).floatValue()); } else if (type == Double.class) { return new Double(((Double) var).doubleValue()); } else if (type == String.class) { return new String(var.toString()); } } return null; }
From source file:com.googlecode.psiprobe.controllers.sql.DataSourceTestController.java
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession sess = request.getSession(false); DataSourceTestInfo sessData = null;//from w ww . j av a 2 s. c o m if (sess != null) { sessData = (DataSourceTestInfo) sess.getAttribute(DataSourceTestInfo.DS_TEST_SESS_ATTR); } String referer = request.getHeader("Referer"); String backURL; if (referer != null) { backURL = referer.replaceAll(replacePattern, ""); } else { backURL = null; } return new ModelAndView(getViewName()) .addObject("maxRows", String.valueOf(sessData == null ? getMaxRows() : sessData.getMaxRows())) .addObject("rowsPerPage", String.valueOf(sessData == null ? getRowsPerPage() : sessData.getRowsPerPage())) .addObject("historySize", String.valueOf(sessData == null ? getHistorySize() : sessData.getHistorySize())) .addObject("backURL", backURL).addObject("collectionPeriod", new Long(getCollectionPeriod())); }
From source file:br.mdarte.exemplo.academico.cd.CursoDAO.java
public List<AbstractEntity> select(long id) throws DAOException { List<AbstractEntity> lista = new ArrayList<AbstractEntity>(); try {/*from w w w. ja va 2 s . c om*/ Session session = currentSession(); CursoAbstract res = (CursoAbstract) session.load(CursoImpl.class, new Long(id)); org.hibernate.Hibernate.initialize(res); lista.add(res); } catch (ObjectNotFoundException onfe) { throw new DAOException(onfe); } catch (HibernateException he1) { throw new DAOException(he1); } return lista; }