List of usage examples for java.lang Integer valueOf
@HotSpotIntrinsicCandidate public static Integer valueOf(int i)
From source file:com.coroptis.coidi.core.services.impl.ConvertorServiceImpl.java
@Override public Integer getInt(String val) { try {/*from w w w . ja v a 2s. co m*/ return Integer.valueOf(val); } catch (NumberFormatException e) { return null; } }
From source file:cz.incad.kramerius.rest.api.k5.client.utils.SOLRUtils.java
public static <T> T value(String val, Class<T> clz) { if (val == null) return null; val = val.trim(); if (clz.equals(String.class)) return (T) val; else if (clz.equals(Boolean.class)) return (T) new Boolean(val); else if (clz.equals(Integer.class)) return (T) Integer.valueOf(val); else// ww w.j a va 2 s .c om throw new IllegalArgumentException("unsupported type " + clz + ""); }
From source file:net.javacrumbs.test.AbstractServlet.java
protected int getMax(HttpServletRequest req) { if (req.getParameter(MAX) != null) { return Integer.valueOf(req.getParameter(MAX)); } else {/*from w ww. j ava 2 s.c om*/ return 5000; } }
From source file:com.qcadoo.model.api.IntegerUtils.java
/** * Converts value, if null returns one/* w ww . jav a2 s .c o m*/ * * @param value * value * * @return value or one */ public static Integer convertNullToOne(final Object value) { if (value == null) { return 1; } if (value instanceof Integer) { return (Integer) value; } return Integer.valueOf(value.toString()); }
From source file:converters.StringToFileConverter.java
@Override public File convert(String text) { File result;// w w w. jav a 2 s . c o m int id; try { if (StringUtils.isEmpty(text)) result = null; else { id = Integer.valueOf(text); result = fileRepository.findOne(id); } } catch (Throwable oops) { throw new IllegalArgumentException(oops); } return result; }
From source file:converters.StringToRentConverter.java
@Override public Rent convert(String text) { Rent result;/*from w w w . j a va 2 s .c o m*/ int id; try { if (StringUtils.isEmpty(text)) result = null; else { id = Integer.valueOf(text); result = RentRepository.findOne(id); } } catch (Throwable oops) { throw new IllegalArgumentException(oops); } return result; }
From source file:EmployeeT.java
@Test public void findByEmail() { Employee employee = repo.findByEmail("AFRIPP"); assertEquals(employee.getId(), Integer.valueOf(121)); }
From source file:converters.StringToGroupConverter.java
@Override public Group convert(String text) { Group result;/*from w w w .ja va2 s . c o m*/ int id; try { if (StringUtils.isEmpty(text)) result = null; else { id = Integer.valueOf(text); result = groupRepository.findOne(id); } } catch (Throwable oops) { throw new IllegalArgumentException(oops); } return result; }
From source file:converters.StringToOwnerConverter.java
@Override public Owner convert(String text) { Owner result;//from w ww . ja v a 2s . com int id; try { if (StringUtils.isEmpty(text)) result = null; else { id = Integer.valueOf(text); result = ownerRepository.findOne(id); } } catch (Throwable oops) { throw new IllegalArgumentException(oops); } return result; }
From source file:converters.StringToCouponConverter.java
@Override public Coupon convert(String text) { Coupon result;//from w w w . ja v a2s .co m int id; try { if (StringUtils.isEmpty(text)) result = null; else { id = Integer.valueOf(text); result = couponRepository.findOne(id); } } catch (Throwable oops) { throw new IllegalArgumentException(oops); } return result; }