List of usage examples for java.lang Integer intValue
@HotSpotIntrinsicCandidate public int intValue()
From source file:com.org.services.impl.FactureServiceImpl.java
/** * //from w ww.j a v a 2s . c o m * @see com.org.services.FactureService#findById(java.lang.Integer) */ @Override public Facture findById(Integer id) { logger.debug("find facture dao"); if (id == null || id.intValue() <= 0) { return null; } try { factureDao = new FactureDaoImpl(persistenceUnit, dbName); return factureDao.findById(id); } catch (DaoException e) { logger.error("Error ", e); return null; } }
From source file:cherry.foundation.render.ObjectRendererImpl.java
private <T> T getSafe(List<T> list, Integer index) { if (index == null) { return list.get(0); } else if (index.intValue() < 0) { return list.get(0); } else if (index.intValue() >= list.size()) { return list.get(list.size() - 1); } else {// w w w . ja va 2 s . c o m return list.get(index.intValue()); } }
From source file:org.esigate.url.StickySessionBaseUrlRetrieveStrategy.java
@Override public String getBaseURL(IncomingRequest originalRequest) { Cookie sessionCookie = getEsiSessionCookie(originalRequest.getCookies()); int index = 0; boolean toGenerate = true; if (null != sessionCookie) { toGenerate = false;//w w w. j a va2 s . co m String indexStr = sessionCookie.getValue(); if (null != indexStr) { try { Integer indexInt = Integer.parseInt(indexStr); index = indexInt.intValue(); } catch (Exception e) { index = -1; } if (index < 0 || index >= this.urls.length) { toGenerate = true; } } else { toGenerate = true; } } if (toGenerate) { index = generateIndex(); Cookie cookie = new BasicClientCookie(ESI_SESSION_COOKIE_NAME, Integer.toString(index)); originalRequest.addNewCookie(cookie); } return this.urls[index]; }
From source file:MainClass.java
public void onGenericTag(PdfWriter writer, Document document, Rectangle rect, String text) { Integer count = (Integer) lines.get(text); if (count == null) { lines.put(text, new Integer(1)); } else {/*from ww w. j a va 2 s . co m*/ lines.put(text, new Integer(count.intValue() + 1)); } }
From source file:com.liangc.hq.base.utils.BizappUtils.java
/** * Check in the permissions map to see if the user can administer HQ. * @return Whether or not the admin cam is contained in the type map. *//*from w w w . j a v a 2 s .c o m*/ public static boolean canAdminHQ(Integer sessionId, AuthzBoss boss) { try { return boss.hasAdminPermission(sessionId.intValue()); } catch (Exception e) { return false; } }
From source file:com.magnet.mmx.server.plugin.mmxmgmt.apns.StubAPNSConnectionKeyedPooledObjectFactory.java
@Override public APNSConnection create(APNSConnectionPoolImpl.APNSConnectionKey key) throws Exception { if (appWithBadCert != null && key.getAppId().equals(appWithBadCert)) { throw new IllegalArgumentException("Can't create connection for:" + key.getAppId()); }/*from w w w.jav a 2s .c om*/ APNSConnection connection = new StubAPNSConnection(key.getAppId(), key.isProduction(), 100L); if (counterMap.putIfAbsent(key, Integer.valueOf(1)) != null) { synchronized (counterMap) { //get the old value Integer prev = counterMap.get(key); counterMap.put(key, Integer.valueOf(prev.intValue() + 1)); } } LOGGER.trace("Created object with code:{} and key:{} ", connection.hashCode(), key); return connection; }
From source file:org.codehaus.mojo.dashboard.report.plugin.chart.FindbugsCategoriesPieChartStrategy.java
public void fillDataset() { if (mDashboardReport instanceof FindBugsReportBean) { float percentVal = 0; FindBugsReportBean findBugsReportBean = (FindBugsReportBean) mDashboardReport; Map categories = findBugsReportBean.getCategories(); Iterator iterator = categories.keySet().iterator(); while (iterator.hasNext()) { String category = (String) iterator.next(); Integer value = (Integer) categories.get(category); percentVal = percent(value.intValue(), findBugsReportBean.getNbBugs()); ((DefaultPieDataset) this.defaultdataset).setValue(category + " = " + percentVal + "%", value.intValue());/*from ww w . j a v a 2s. c om*/ } } }
From source file:org.codehaus.mojo.dashboard.report.plugin.chart.FindbugsPrioritiesPieChartStrategy.java
public void fillDataset() { if (mDashboardReport instanceof FindBugsReportBean) { float percentVal = 0; FindBugsReportBean findBugsReportBean = (FindBugsReportBean) mDashboardReport; Map priorities = findBugsReportBean.getPriorities(); Iterator iterator = priorities.keySet().iterator(); while (iterator.hasNext()) { String priority = (String) iterator.next(); Integer value = (Integer) priorities.get(priority); percentVal = percent(value.intValue(), findBugsReportBean.getNbBugs()); ((DefaultPieDataset) this.defaultdataset).setValue(priority + " = " + percentVal + "%", value.intValue());//from www.ja v a 2s . com } } }
From source file:com.mobileman.projecth.business.security.DecoderServiceTest.java
/** * /*w w w.j a va2 s.c o m*/ * @throws Exception */ @Test public void decodeInteger() throws Exception { assertNull(decoderService.decodeInteger(null)); Integer result = decoderService.decodeInteger("w2gNG97Ppv1UhM3an6+KQA=="); assertEquals(100, result.intValue()); }
From source file:org.mule.extras.springproxies.SynchClientFactoryBeanTestCase.java
public void testMethodsUsingVM() throws UMOException { ApplicationContext ctx = new ClassPathXmlApplicationContext("synchclient-client-config.xml"); AService service = (AService) ctx.getBean("testServiceVM"); // methodInteger(Integer i) {// w w w. j av a2s .c o m Integer result = service.methodInteger(9999); assertEquals(9999, result.intValue()); } // methodStr(String str) { String result = service.methodStr("Karl-Johan"); assertEquals("Karl-Johan_1", result); } // methodStr(String str1, String str2) { String result = service.methodStr("Karl", "Johan"); assertEquals("Karl_1_Johan_2", result); } // methodStr(String str1, String str2, String str3) { String result = service.methodStr("Karl", "Johan", "Linus"); assertEquals("Karl_1_Johan_2_Linus_3", result); } // methodStr2(String str) { String result = service.methodStr2("Linus"); assertEquals("Linus_2", result); } // Anything aMethod(Something s) { Anything result = service.aMethod(new Something("nothing")); assertNotNull(result); assertEquals("Result from AServiceImpl, recived: 'nothing'", result.getMsg()); assertEquals(123456.999, result.getValue(), 0.0001); } }