List of usage examples for java.lang Integer intValue
@HotSpotIntrinsicCandidate public int intValue()
From source file:com.bstek.dorado.view.config.definition.AssembledComponentExpressionObject.java
public String id(String id) { String realId = idMap.get(id); if (StringUtils.isNotEmpty(realId)) { return realId; }//from w ww .ja v a 2s .co m Context context = Context.getCurrent(); Integer maxId = (Integer) context.getAttribute(Context.THREAD, MAX_ID_KEY); int sn = 0; if (maxId != null) { sn = maxId.intValue(); } sn++; realId = id + '_' + sn; context.setAttribute(Context.THREAD, MAX_ID_KEY, new Integer(sn)); idMap.put(id, realId); return realId; }
From source file:thymeleafexamples.stsm.web.controller.SeedStarterMngController.java
@RequestMapping(value = "/seedstartermng", params = { "removeRow" }) public String removeRow(final SeedStarter seedStarter, final BindingResult bindingResult, final HttpServletRequest req) { final Integer rowId = Integer.valueOf(req.getParameter("removeRow")); seedStarter.getRows().remove(rowId.intValue()); return "seedstartermng"; }
From source file:io.kahu.hawaii.domain.StringProperty.java
public StringProperty(String value, Integer minLength, Integer maxLength) { super(value); if (minLength != null) { this.minLength = minLength.intValue(); }/*from w w w .ja v a2 s .c o m*/ if (maxLength != null) { this.maxLength = maxLength.intValue(); Assert.isTrue(maxLength > 0); } if (minLength != null && maxLength != null) { Assert.isTrue(minLength <= maxLength); } }
From source file:com.aurel.track.fieldType.fieldChange.converter.DoubleSetterConverter.java
/** * Convert the string to object value after load * @param value/*from www .j a va2 s . c o m*/ * @param setter * @return */ @Override public Object getActualValueFromStoredString(String value, Integer setter) { if (value == null || "".equals(value) || setter == null) { return null; } switch (setter.intValue()) { case FieldChangeSetters.SET_TO: case FieldChangeSetters.ADD_IF_SET: case FieldChangeSetters.ADD_OR_SET: try { return new Double(value); } catch (Exception e) { LOGGER.warn("Converting the " + value + " to Double from xml string failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } return null; }
From source file:com.kzk.stsm.controller.SeedStarterMngController.java
@RequestMapping(value = "/seedstartermng", params = { "removeRow" }) public String removeRow(final SeedStarter seedStarter, final BindingResult bindingResult, final HttpServletRequest req) { final Integer rowId = Integer.valueOf(req.getParameter("removeRow")); seedStarter.getRows().remove(rowId.intValue()); return "stsm/seedstartermng"; }
From source file:com.aurel.track.fieldType.fieldChange.converter.IntegerSetterConverter.java
/** * Convert the string to object value after load * @param value/* www. ja v a 2 s . c o m*/ * @param setter * @return */ @Override public Object getActualValueFromStoredString(String value, Integer setter) { if (value == null || "".equals(value) || setter == null) { return null; } switch (setter.intValue()) { case FieldChangeSetters.SET_TO: case FieldChangeSetters.ADD_IF_SET: case FieldChangeSetters.ADD_OR_SET: try { return Integer.valueOf(value); } catch (Exception e) { LOGGER.warn("Converting the " + value + " to Integer failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } return null; }
From source file:com.aurel.track.fieldType.fieldChange.converter.CompositeSelectSetterConverter.java
/** * Convert the string to object value after load * @param value/*from w w w. j av a2s. c om*/ * @param setter * @return */ @Override public Object getActualValueFromStoredString(String value, Integer setter) { if (value == null || setter == null) { return null; } switch (setter.intValue()) { case FieldChangeSetters.SET_TO: SortedMap<Integer, Integer[]> actualValuesMap = new TreeMap<Integer, Integer[]>(); String[] partStringArr = value.split(PART_SPLITTER_STRING); if (partStringArr != null && partStringArr.length > 0) { for (int i = 0; i < partStringArr.length; i++) { String partString = partStringArr[i]; if (partString != null && !"".equals(partString)) { try { Integer partValue = Integer.valueOf(partString); actualValuesMap.put(Integer.valueOf(i + 1), new Integer[] { partValue }); } catch (Exception e) { LOGGER.warn("Converting the " + i + 1 + "th part " + partString + " to Integer failed with " + e.getMessage()); LOGGER.debug(ExceptionUtils.getStackTrace(e)); } } } } return actualValuesMap; } return null; }
From source file:com.cronutils.model.time.generator.BetweenDayOfWeekValueGenerator.java
@Override protected List<Integer> generateCandidatesNotIncludingIntervalExtremes(int start, int end) { List<Integer> values = Lists.newArrayList(); Between between = (Between) cronField.getExpression(); // we have a range of days of week, so we will generate a list for each day and then combine them int startDayOfWeek = 0; int endDayOfWeek = 0; Object obj = between.getFrom().getValue(); if (obj instanceof Integer) { Integer i = (Integer) obj; startDayOfWeek = i.intValue(); }/*ww w . jav a 2 s.co m*/ obj = between.getTo().getValue(); if (obj instanceof Integer) { Integer i = (Integer) obj; endDayOfWeek = i.intValue(); } for (int i = startDayOfWeek; i <= endDayOfWeek; i++) { // Build a CronField representing a single day of the week FieldConstraintsBuilder fcb = FieldConstraintsBuilder.instance().forField(CronFieldName.DAY_OF_WEEK); CronParserField parser = new CronParserField(CronFieldName.DAY_OF_WEEK, fcb.createConstraintsInstance()); CronField cronField = parser.parse(Integer.toString(i)); // now a generator for matching days OnDayOfWeekValueGenerator odow = new OnDayOfWeekValueGenerator(cronField, year, month, mondayDoWValue); // get the list of matching days List<Integer> candidatesList = odow.generateCandidates(start, end); // add them to the master list if (candidatesList != null) { values.addAll(candidatesList); } } Collections.sort(values); return values; }
From source file:com.liusoft.dlog4j.upload.SecurityFCKUploadServlet.java
/** * ?/*from ww w . j a v a2 s . c o m*/ */ protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { //??????(??) SessionUserObject loginUser = UserLoginManager.getLoginUser(req, res, true); if (loginUser != null) { super.doPost(req, res);//post?? Integer errno = (Integer) req.getAttribute("errno"); if (errno != null && errno.intValue() == 0) { //? FckUploadFileBean fbean = new FckUploadFileBean(); try { Long fileSize = (Long) req.getAttribute("file.size"); Integer fileType = (Integer) req.getAttribute("file.type"); String savePath = (String) req.getAttribute("file.path"); String uriPath = (String) req.getAttribute("file.uri"); if (fileSize != null) fbean.setFileSize(fileSize.intValue()); if (fileType != null) fbean.setFileType(fileType.intValue()); fbean.setSavePath(savePath); fbean.setUri(uriPath); HttpSession ssn = req.getSession(true); //SESSION_ID??Cookie RequestUtils.setCookie(req, res, Globals.SESSION_ID_KEY_IN_COOKIE, ssn.getId(), -1); fbean.setSessionId(ssn.getId()); fbean.setUser(new UserBean(loginUser.getId())); fbean.setUploadTime(new Date()); FCKUploadFileDAO.createUploadFileItem(fbean); } catch (Exception e) { log.error("Writting upload file info failed.", e); } } return; } res.sendError(HttpServletResponse.SC_FORBIDDEN); }
From source file:net.turnbig.jdbcx.test.JdbcxQueryTest.java
@Test public void testQueryPrimitiveObject() { Integer count = jdbc.queryForObject("select count(0) from member", Integer.class); Assert.assertEquals("total records is 2", count.intValue(), 2); Long countLong = jdbc.queryForObject("select count(0) from member", Long.class); Assert.assertEquals("total records is 2", countLong.intValue(), 2); Member m = new Member(); m.setName("woo"); Boolean isAdmin = jdbc.queryForObject("select is_admin from member where name = :name", m, Boolean.class); Assert.assertTrue(isAdmin);//from ww w.j a va 2 s. c o m }