List of usage examples for java.lang Integer longValue
public long longValue()
From source file:com.egt.ejb.toolkit.ToolKitUtils.java
public static String getCopyright(Integer cr) { long l = cr == null ? -1L : cr.longValue(); return getCopyright(l); }
From source file:utils.gce.GoogleComputeEngineClient.java
private static AttachedDisk createAttachedDisk(String name, Integer sizeGb, String diskType, String sourceImage) {/* w w w. j a va 2 s. c o m*/ AttachedDiskInitializeParams paramaters = new AttachedDiskInitializeParams(); paramaters.setDiskName(name); paramaters.setDiskSizeGb(sizeGb.longValue()); if (diskType != null && !diskType.isEmpty()) { paramaters.setDiskType(diskType); } if (sourceImage != null && !sourceImage.isEmpty()) { paramaters.setSourceImage(sourceImage); } AttachedDisk disk = new AttachedDisk(); disk.setBoot(true); //disk.setType("PERSISTENT"); disk.setMode("READ_WRITE"); disk.setAutoDelete(true); disk.setInitializeParams(paramaters); return disk; }
From source file:wwutil.sys.ReflectUtil.java
public static void incrementField(Object dataObj, Field field, int incrementAmount) throws Exception { if (field.getType() == Integer.class || field.getType() == int.class) { Integer value = (Integer) field.get(dataObj); value = value == null ? new Integer(1) : new Integer(value.intValue() + 1); field.set(dataObj, value);//from w w w . j av a2 s. co m } else if (field.getType() == Long.class || field.getType() == long.class) { Long value = (Long) field.get(dataObj); value = value == null ? new Long(1) : new Long(value.longValue() + 1); field.set(dataObj, value); } else { throw new IllegalArgumentException("Cannot increment non-integer field " + field); } }
From source file:org.apache.ranger.audit.provider.MiscUtil.java
public static String getJvmInstanceId() { Integer val = Integer.valueOf(sJvmID.toString().hashCode()); long longVal = val.longValue(); String ret = Long.toString(Math.abs(longVal)); return ret;//from ww w . j av a2 s . c om }
From source file:ConversionUtil.java
public static byte[] convertToByteArray(Object object) throws Exception { byte[] returnArray = null; Class clazz = object.getClass(); String clazzName = clazz.getName(); if (clazz.equals(Integer.class)) { Integer aValue = (Integer) object; int intValue = aValue.intValue(); returnArray = convertToByteArray(intValue); } else if (clazz.equals(String.class)) { String aValue = (String) object; returnArray = convertToByteArray(aValue); } else if (clazz.equals(Byte.class)) { Byte aValue = (Byte) object; byte byteValue = aValue.byteValue(); returnArray = convertToByteArray(byteValue); } else if (clazz.equals(Long.class)) { Long aValue = (Long) object; long longValue = aValue.longValue(); returnArray = convertToByteArray(longValue); } else if (clazz.equals(Short.class)) { Short aValue = (Short) object; short shortValue = aValue.shortValue(); returnArray = convertToByteArray(shortValue); } else if (clazz.equals(Boolean.class)) { Boolean aValue = (Boolean) object; boolean booleanValue = aValue.booleanValue(); returnArray = convertToByteArray(booleanValue); } else if (clazz.equals(Character.class)) { Character aValue = (Character) object; char charValue = aValue.charValue(); returnArray = convertToByteArray(charValue); } else if (clazz.equals(Float.class)) { Float aValue = (Float) object; float floatValue = aValue.floatValue(); returnArray = convertToByteArray(floatValue); } else if (clazz.equals(Double.class)) { Double aValue = (Double) object; double doubleValue = aValue.doubleValue(); returnArray = convertToByteArray(doubleValue); } else {/*from ww w.j a va 2 s. c o m*/ throw new Exception("Cannot convert object of type " + clazzName); } return returnArray; }
From source file:org.opencastproject.archive.opencast.solr.Schema.java
public static Long getDcExtent(SolrDocument doc) { Integer extent = (Integer) doc.get(DC_EXTENT); return extent != null ? extent.longValue() : null; }
From source file:pl.java.scalatech.generator.RandomPersonService.java
public Stream<User> generate(Integer count) { return generate(count.longValue()); }
From source file:com.thoughtworks.studios.journey.jql.conditions.IntValue.java
public IntValue(Integer val) { this.val = val.longValue(); }
From source file:org.lendingclub.mercator.bind.model.ResourceRecordSet.java
public ResourceRecordSet<T> withTtl(Integer ttl) { if (ttl != null) { boolean isCorrect = ttl >= 0 && ttl.longValue() <= 0x7FFFFFFFL; Preconditions.checkArgument(isCorrect, "Invalid ttl value: %s, must be 0-2147483647", ttl); }/*from w w w. j a va 2s . co m*/ this.ttl = ttl; return this; }
From source file:service.ArticleService.java
private Long getLong(Object value) { if (value != null) { if (value instanceof Long) { return (Long) value; } else if (value instanceof BigInteger) { BigInteger bi = (BigInteger) value; return bi.longValue(); } else if (value instanceof Integer) { Integer i = (Integer) value; return i.longValue(); }//from w w w . j a va 2 s. c o m } return null; }