List of usage examples for java.lang Long toString
public String toString()
From source file:com.nridge.core.base.std.XMLUtl.java
public static void makeElemLongValue(Document aDocument, Element anElement, String aName, long aValue) { Long longObject; Element subElement;/*from w w w . j av a2s . co m*/ if (StringUtils.isNotEmpty(aName)) { longObject = aValue; subElement = aDocument.createElement(aName); subElement.appendChild(aDocument.createTextNode(longObject.toString())); anElement.appendChild(subElement); } }
From source file:com.ge.predix.web.cors.test.CORSFilterTest.java
private static CORSFilter createConfiguredCORSFilter() { CORSFilter corsFilter = new CORSFilter(); List<String> allowedUris = new ArrayList<String>( Arrays.asList(new String[] { "^/uaa/userinfo$", "^/uaa/logout\\.do$" })); setInternalState(corsFilter, "corsXhrAllowedUris", allowedUris); List<String> allowedOrigins = new ArrayList<String>(Arrays.asList(new String[] { "example.com$" })); setInternalState(corsFilter, "corsXhrAllowedOrigins", allowedOrigins); List<String> allowedHeaders = Arrays.asList(new String[] { "Accept", "Authorization" }); corsFilter.setAllowedHeaders(allowedHeaders); List<String> allowedMethods = Arrays.asList(new String[] { "GET", "OPTIONS" }); corsFilter.setAllowedMethods(allowedMethods); Long maxAge = 1728000L; corsFilter.setMaxAge(maxAge.toString()); corsFilter.initialize();//from w w w. j a v a 2 s. c om return corsFilter; }
From source file:com.omnigon.aem.common.utils.JcrPropertyUtil.java
/** * * @param node JCR node//from w w w .j a va 2s . c om * @param propName property name * @param propValue property value * @throws RepositoryException - */ public static void updateProperty(final Node node, final String propName, final Long propValue) throws RepositoryException { boolean hasProperty = node.hasProperty(propName); if (!hasProperty && propValue != null) { updateLongProperty(node, propName, propValue); } else if (hasProperty && propValue == null) { updateLongProperty(node, propName, null); } else if (hasProperty && !StringUtils.equals(propValue.toString(), node.getProperty(propName).getString())) { updateLongProperty(node, propName, propValue); } }
From source file:fxts.stations.util.UserPreferences.java
public static String getStringValue(Long aValue) { return aValue.toString(); }
From source file:cr.ac.uia.SistemaGC.utils.AES.java
public static String encrypt(Long cedula, String usuario, String contrasena) { //<editor-fold defaultstate="collapsed" desc="Mtodo para cifrar contraseas"> /*//from w ww.j a v a 2 s . c om * Inspirado en: * http://stackoverflow.com/questions/15554296/simple-java-aes-encrypt-decrypt-example */ try { IvParameterSpec iv = new IvParameterSpec(fitString(usuario, 16).getBytes("UTF-8")); SecretKeySpec skeySpec = new SecretKeySpec(fitString(cedula.toString(), 16).getBytes("UTF-8"), "AES"); Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv); byte[] encrypted = cipher.doFinal(contrasena.getBytes()); return Base64.encodeBase64String(encrypted); } catch (UnsupportedEncodingException | NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException | InvalidAlgorithmParameterException | IllegalBlockSizeException | BadPaddingException e) { e.printStackTrace(); System.err.println(e.getClass().getName() + ": " + e.getMessage()); System.exit(0); } return null; //</editor-fold> }
From source file:com.facebook.ads.sdk.AppLinks.java
public static AppLinks fetchById(Long id, APIContext context) throws APIException { return fetchById(id.toString(), context); }
From source file:jsonxml.XML.java
/** * Try to convert a string into a number, boolean, or null. If the string * can't be converted, return the string. This is much less ambitious than * JSONObject.stringToValue, especially because it does not attempt to * convert plus forms, octal forms, hex forms, or E forms lacking decimal * points.//w ww. j a v a2 s . c o m * @param string A String. * @return A simple JSON value. */ public static Object stringToValue(String string) { if ("true".equalsIgnoreCase(string)) { return Boolean.TRUE; } if ("false".equalsIgnoreCase(string)) { return Boolean.FALSE; } if ("null".equalsIgnoreCase(string)) { return JSONObject.NULL; } // If it might be a number, try converting it, first as a Long, and then as a // Double. If that doesn't work, return the string. try { char initial = string.charAt(0); if (initial == '-' || (initial >= '0' && initial <= '9')) { Long value = new Long(string); if (value.toString().equals(string)) { return value; } } } catch (Exception ignore) { try { Double value = new Double(string); if (value.toString().equals(string)) { return value; } } catch (Exception ignoreAlso) { } } return string; }
From source file:com.hurence.logisland.processor.networkpacket.utils.PcapUtils.java
public static String getSessionKey(JSONObject message) { String srcIp = (String) message.get("ip_src_addr"); String dstIp = (String) message.get("ip_dst_addr"); Long protocol = (Long) message.get("ip_protocol"); Long srcPort = (Long) message.get("ip_src_port"); Long dstPort = (Long) message.get("ip_dst_port"); Long ipId = (Long) message.get("ip_id"); String ipIdString = ipId == null ? null : ipId.toString(); Long fragmentOffset = (Long) message.get("frag_offset"); String fragmentOffsetString = fragmentOffset == null ? null : fragmentOffset.toString(); return PcapUtils.getSessionKey(srcIp, dstIp, protocol.toString(), srcPort.toString(), dstPort.toString(), ipIdString, fragmentOffsetString); }
From source file:com.aliyun.odps.local.common.utils.DownloadUtils.java
private static String getColumnValueString(TableMeta tableMeta, Record record, int colIndex) { String colValue = null;//from www . j a v a 2s. c o m Column col = tableMeta.getCols()[colIndex]; if (record.get(col.getName()) == null) { return "\\N"; } switch (col.getType()) { case BIGINT: { Long v = record.getBigint(col.getName()); colValue = v == null ? null : v.toString(); break; } case BOOLEAN: { Boolean v = record.getBoolean(col.getName()); colValue = v == null ? null : v.toString(); break; } case DOUBLE: { Double v = record.getDouble(col.getName()); colValue = v == null ? null : v.toString(); break; } case STRING: { byte[] v = record.getBytes(col.getName()); try { colValue = v == null ? null : LocalRunUtils.toReadableString(v); } catch (Exception e) { throw new RuntimeException("convert to readable string failed!" + e); } break; } case DATETIME: { Date v = record.getDatetime(col.getName()); colValue = v == null ? null : LocalRunUtils.getDateFormat(Constants.DATE_FORMAT_2).format(v); break; } default: throw new RuntimeException("Unknown column type: " + col.getType()); } if (colValue == null) { return Constants.NULL_TOKEN; } else { return colValue.replaceAll("\\\\N", "\"\\\\N\""); } }
From source file:com.facebook.ads.sdk.AdPlacePageSet.java
public static AdPlacePageSet fetchById(Long id, APIContext context) throws APIException { return fetchById(id.toString(), context); }