List of usage examples for java.lang Number longValue
public abstract long longValue();
From source file:com.weibo.api.motan.rpc.URL.java
public Long getLongParameter(String name, long defaultValue) { Number n = getNumbers().get(name); if (n != null) { return n.longValue(); }/*w w w. j a v a2s. c om*/ String value = parameters.get(name); if (value == null || value.length() == 0) { return defaultValue; } long l = Long.parseLong(value); getNumbers().put(name, l); return l; }
From source file:com.weibo.api.motan.rpc.URL.java
public Long getMethodParameter(String methodName, String paramDesc, String name, long defaultValue) { String key = methodName + "(" + paramDesc + ")." + name; Number n = getNumbers().get(key); if (n != null) { return n.longValue(); }//from w w w. j a va 2 s .com String value = getMethodParameter(methodName, paramDesc, name); if (value == null || value.length() == 0) { return defaultValue; } long l = Long.parseLong(value); getNumbers().put(key, l); return l; }
From source file:org.mongojack.internal.object.BsonObjectTraversingParser.java
@Override public BigInteger getBigIntegerValue() throws IOException { Number n = currentNumericNode(); if (n instanceof BigInteger) { return (BigInteger) n; } else {//from ww w. jav a 2 s. c om return BigInteger.valueOf(n.longValue()); } }
From source file:com.github.jsonj.JsonPrimitive.java
public JsonPrimitive(final Number n) { if (n == null) { type = JsonType.nullValue;/* ww w. ja v a 2s. c om*/ value = null; } else { type = JsonType.number; if (n instanceof Integer) { // make sure to handle Integers and Longs consistently with json simple (always a long) value = n.longValue(); } else { value = n; } } }
From source file:org.kie.server.services.jbpm.ExecutorServiceBase.java
public RequestInfoInstanceList getRequestsByProcessInstance(Number processInstanceId, List<String> statuses, Integer page, Integer pageSize) { List<STATUS> statusList = convertStatusList(statuses); List<RequestInfo> requests = executorService.getRequestsByProcessInstance(processInstanceId.longValue(), statusList, buildQueryContext(page, pageSize)); RequestInfoInstanceList result = convertToRequestInfoList(requests, false, false); return result; }
From source file:org.openepics.discs.ccdb.core.ejb.ApplicationService.java
private void checkDevicesTable() { final Number oldSchemaColumns = (Number) em .createNativeQuery("SELECT COUNT(*) " + "FROM information_schema.columns " + "WHERE table_schema = 'public' " + "AND table_name = 'device' " + "AND column_name IN " + "('description', 'location', 'manuf_model', 'manuf_serial_number', " + "'manufacturer', 'purchase_order', 'status')") .getSingleResult();/*from w w w. j ava 2 s .c o m*/ if (oldSchemaColumns.longValue() > 0) { LOGGER.log(Level.WARNING, "Database table 'device' contains columns which are no longer needed. " + "Execute 'postgres-db-schemas/device_update1.sql' SQL queries to remove them."); LOGGER.log(Level.WARNING, "* * * THIS IS A POSTGRESQL SCRIPT. TRANSLATE IF USING ANOTHER BACKEND! * * *"); } }
From source file:nz.co.senanque.rules.OperationsImpl.java
@InternalFunction() public Long toLong(Number value) { if (value == null) { return new Long(0L); }//from ww w .j a v a 2 s. c o m return value.longValue(); }
From source file:io.fabric8.apiman.rest.BearerTokenFilter.java
/** * @see javax.servlet.Filter#init(javax.servlet.FilterConfig) *//* ww w .j a v a2s .c o m*/ @Override public void init(FilterConfig config) throws ServletException { // maximum 10000 tokens in the cache Number bearerTokenCacheMaxsize = getSystemPropertyOrEnvVar(BEARER_TOKEN_CACHE_MAXSIZE, 10000); // cache for 10 min Number bearerTokenTTL = getSystemPropertyOrEnvVar(BEARER_TOKEN_TTL, 10); bearerTokenCache = CacheBuilder.newBuilder().concurrencyLevel(4) // allowed concurrency among update operations .maximumSize(bearerTokenCacheMaxsize.longValue()) .expireAfterWrite(bearerTokenTTL.longValue(), TimeUnit.MINUTES) .build(new CacheLoader<String, UserInfo>() { public UserInfo load(String authToken) throws Exception { return getUserInfoFromK8s(authToken); } }); }
From source file:org.patientview.radar.dao.impl.UtilityDaoImpl.java
public void saveConsultant(final Consultant consultant) throws Exception { Map<String, Object> consultantMap = new HashMap<String, Object>() { {//from w ww .ja va2 s. com put("cSNAME", consultant.getSurname()); put("cFNAME", consultant.getForename()); put("cCentre", consultant.getCentre().getId()); put("cID", consultant.getId()); } }; if (consultant.hasValidId()) { String updateSql = buildUpdateQuery("tbl_Consultants", "cID", consultantMap); namedParameterJdbcTemplate.update(updateSql, consultantMap); } else { Number id = consultantsInsert.executeAndReturnKey(consultantMap); consultant.setId(id.longValue()); } }
From source file:io.github.xfally.cordova.plugin.ftp.CDVFtp.java
private void downloadFile(String localFile, String remoteFile, CallbackContext callbackContext) { if (localFile == null || remoteFile == null) { callbackContext.error("Expected localFile and remoteFile."); } else {//from www.j a v a 2s . c o m try { String remoteFilePath = remoteFile.substring(0, remoteFile.lastIndexOf('/') + 1); String remoteFileName = remoteFile.substring(remoteFile.lastIndexOf('/') + 1); this.client.changeDirectory(remoteFilePath); FTPFile[] list = client.list(); JSONArray fileList = new JSONArray(); for (FTPFile file : list) { String name = file.getName(); //Number type = file.getType(); //String link = file.getLink(); Number size = file.getSize(); if (remoteFileName.equals(name)) { client.download(remoteFileName, new File(localFile), new CDVFtpTransferListener(size.longValue(), callbackContext)); // refer to CDVFtpTransferListener for transfer percent and completed return; } } // should never reach here! } catch (Exception e) { callbackContext.error(e.toString()); } } }