Example usage for java.lang Long valueOf

List of usage examples for java.lang Long valueOf

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public static Long valueOf(long l) 

Source Link

Document

Returns a Long instance representing the specified long value.

Usage

From source file:org.homiefund.web.formatters.UserFormatter.java

@Override
public UserDTO parse(String s, Locale locale) throws ParseException {
    if (StringUtils.isEmpty(s)) {
        throw new ParseException("Passed empty text", 0);
    } else {//from   w  w w. j  ava 2s.  c o m
        UserDTO user = new UserDTO();
        user.setId(Long.valueOf(s));

        return user;
    }
}

From source file:org.thymeleaf.engine21.conversion.conversion3.LongFormatter.java

public Long parse(final String text, final Locale locale) throws ParseException {
    final NumberFormat numberFormat = NumberFormat.getNumberInstance(Locale.US);
    return Long.valueOf(numberFormat.parse(text).longValue());
}

From source file:de.hybris.platform.acceleratorservices.dataimport.batch.converter.SequenceIdTranslator.java

@Override
public Object importValue(final String valueExpr, final Item toItem) throws JaloInvalidParameterException {
    clearStatus();/*w ww  .j  a  va  2  s . co m*/
    Long result = null;
    if (!StringUtils.isBlank(valueExpr)) {
        try {
            result = Long.valueOf(valueExpr);
        } catch (final NumberFormatException exc) {
            throw new JaloInvalidParameterException(exc, 0);
        }
        if (toItem != null) {
            Long curSeqId = null;
            try {
                curSeqId = (Long) toItem.getAttribute("sequenceId");
            } catch (final JaloSecurityException e) {
                throw new SystemException("attribute sequenceId unreadable for item " + toItem.getPK(), e);
            }
            if (curSeqId != null && isInValidSequenceId(result, curSeqId)) {
                setError();
            }
        }
    }
    return result;
}

From source file:HotaxApplication.java

@Bean
public Converter<String, Message> messageConverter() {
    return new Converter<String, Message>() {
        @Override/*w  w w  .j  av  a  2  s. c o m*/
        public Message convert(String id) {
            return messageRepository().findMessage(Long.valueOf(id));
        }
    };
}

From source file:data.dao.SubModelDao.java

public HashMap<Long, String> getGenIdUrlMap() {
    HashMap<Long, String> res = new HashMap();
    String sql = "select id,url from car_model_generation";
    SQLQuery query = currentSession().createSQLQuery(sql);
    query.setResultTransformer(Criteria.ALIAS_TO_ENTITY_MAP);
    List data = query.list();/*  w w  w.  j av  a 2s  .c  o m*/

    for (Object object : data) {
        Map row = (Map) object;
        res.put(Long.valueOf((int) row.get("id")), StringAdapter.getString(row.get("url")));
    }
    return res;
}

From source file:com.alibaba.stonelab.toolkit.cs4p.communication.cmd.PlayerAdd.java

@Override
public Cmd parser(String cmd) {
    String[] token = cmd.split(" ");
    if (token.length != 4) {
        return null;
    }/*from   w w w .  j  a  v a  2 s. co m*/
    if (!CMD.equals(token[0])) {
        return null;
    }
    if (!(StringUtils.isNumeric(token[2]) && StringUtils.isNumeric(token[3]))) {
        return null;
    }
    this.setName(token[1]);
    this.setX(Long.valueOf(token[2]));
    this.setY(Long.valueOf(token[3]));
    return this;
}

From source file:com.alibaba.zonda.logger.server.util.DirectoryListener.java

public List<File> list(File startDirectory, String filterRegex) throws IOException {
    List<File> dirList = new ArrayList<File>();
    walk(startDirectory, dirList);/*from   w w w  . ja  v  a 2s.  com*/
    Collections.sort(dirList, new Comparator<File>() {
        public int compare(File f1, File f2) {
            return (Long.valueOf(f1.lastModified())).compareTo(Long.valueOf(f2.lastModified()));
        }
    });
    List<File> filteredDirList = new ArrayList<File>();
    for (File f : dirList) {
        if (f.getName().matches(filterRegex)) {
            filteredDirList.add(f);
        }
    }
    return filteredDirList;
}

From source file:testapp.web.PersonFormController.java

protected Object formBackingObject(HttpServletRequest request) throws ServletException {
    // get the Owner referred to by id in the request
    Person p = null;/*from w  ww  .  j  a  v  a  2  s  . co  m*/
    String personId = request.getParameter("personId");
    if (personId != null) {
        logger.debug("Fetching person " + personId);
        p = getPersonDao().findById(Long.valueOf(personId));
    } else {
        logger.debug("No personId, creating new Person");
        p = new Person();
    }
    return p;
}

From source file:ua.epam.rd.web.AbstractPizzaContoller.java

@InitBinder
private void pizzaBinder(WebDataBinder binder) {
    binder.registerCustomEditor(Pizza.class, new PropertyEditorSupport() {
        @Override/* www  .  j  av a2 s  .c  om*/
        public void setAsText(String pizzaId) {
            Pizza pizza = null;
            if (pizzaId != null && !pizzaId.trim().isEmpty()) {
                Long id = Long.valueOf(pizzaId);
                pizza = getPizzaById(id);
            }
            setValue(pizza);
        }
    });
}

From source file:todos.JpaPersistenceCallback.java

@Override
public T findOne(String id) {
    return repo.findOne(Long.valueOf(id));
}