Example usage for java.lang Long parseLong

List of usage examples for java.lang Long parseLong

Introduction

In this page you can find the example usage for java.lang Long parseLong.

Prototype

public static long parseLong(String s) throws NumberFormatException 

Source Link

Document

Parses the string argument as a signed decimal long .

Usage

From source file:com.mycompany.CRMFly.Converters.ContragentInContractConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {

    Long id = Long.parseLong(value.split(" ")[0]);
    return contractBean.getAgentForId(id);

}

From source file:com.mycompany.CRMFly.Converters.ContragentInShipmentConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {

    Long id = Long.parseLong(value.split(" ")[0]);
    return shipmentBean.getAgentForId(id);

}

From source file:com.mycompany.CRMFly.Converters.ProductPositionInContractConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {

    Long id = Long.parseLong(value.split(" ")[0]);
    return contractBean.getPositionForId(id);

}

From source file:com.mycompany.CRMFly.Converters.ProductPositionInShipmentConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {

    Long id = Long.parseLong(value.split(" ")[0]);
    return shipmentBean.getPositionForId(id);

}

From source file:cz.strmik.cmmitool.web.controller.propertyeditor.RatingScaleEditor.java

@Override
public void setAsText(String text) {
    if (StringUtils.isEmpty(text)) {
        setValue(null);/* ww  w.  j  a  v  a 2  s. c o  m*/
    } else {
        setValue(ratingScaleDao.read(Long.parseLong(text)));
    }
}

From source file:com.github.dbourdette.otto.web.util.SizeInBytes.java

public static SizeInBytes fromValue(String value) {
    if (StringUtils.isEmpty(value)) {
        throw new IllegalArgumentException("value is not a valid size");
    }/*w  w  w .j  a va2s.  c  om*/

    long multiplier = 1;

    if (value.endsWith("M")) {
        value = StringUtils.substringBeforeLast(value, "M");
        multiplier = SCALE * SCALE;
    } else if (value.endsWith("K")) {
        value = StringUtils.substringBeforeLast(value, "K");
        multiplier = SCALE;
    } else if (value.endsWith("B")) {
        value = StringUtils.substringBeforeLast(value, "B");
    }

    try {
        return new SizeInBytes(Long.parseLong(value) * multiplier);
    } catch (Exception e) {
        throw new IllegalArgumentException("value is not a valid size");
    }
}

From source file:Main.java

/**
 * @param rawValue//from w w w  .j a  v  a2s  . co  m
 * @return
 * @throws Exception 
 */
public static long decodeRawValueToSingleLong(String rawValue) throws Exception {
    String[] values = getSingleValue(rawValue);
    if ("l".equals(values[0]))
        return Long.parseLong(values[1]);
    throw new Exception("Data type is not 'l' (long), found '" + values[0] + "'");
}

From source file:cz.strmik.cmmitool.web.controller.propertyeditor.ProcessGroupEditor.java

@Override
public void setAsText(String text) {
    if (StringUtils.isEmpty(text)) {
        setValue(null);//from www  .ja  v a 2 s  . co m
    } else {
        setValue(processGroupDao.read(Long.parseLong(text)));
    }
}

From source file:com.wms.utils.DataUtil.java

public static Long[] convertLongArr(Object input) {
    String inputArr = (String) input;
    String[] idArr = ((String) input).split(",");
    Long[] idLong = new Long[idArr.length];
    for (int i = 0; i < idArr.length; i++) {
        try {/*ww w .j a  v a2 s .c o m*/
            idLong[i] = Long.parseLong(idArr[i]);
        } catch (NumberFormatException e) {
            idLong[i] = 0L;
            log.info("Error parsing long");
        }
    }
    return idLong;
}

From source file:com.oic.event.GetUserInfo.java

@Override
public void ActionEvent(JSONObject json, WebSocketListener webSocket) {
    JSONObject responseJSON = new JSONObject();
    responseJSON.put("method", "getuserinfo");
    OicCharacter c = webSocket.getCharacter();
    long userid = c.getUserId();
    int mapid = c.getMapid();
    if (validation(json)) {
        userid = Long.parseLong(json.get("userid").toString());
        mapid = Integer.parseInt(json.get("mapid").toString());
    }//from www . ja va2 s  .c  o m
    System.out.println("mapid : " + mapid);
    System.out.println("userid : " + userid);
    try {
        getUserinfo(responseJSON, userid, mapid);
    } catch (NullPointerException e) {
        responseJSON.put("status", 1);
    }
    webSocket.sendJson(responseJSON);
}