List of usage examples for java.lang Integer Integer
@Deprecated(since = "9") public Integer(String s) throws NumberFormatException
From source file:com.adaptris.core.services.jdbc.types.StringColumnTranslatorTest.java
@Test public void testAsIntegerTranslator() throws Exception { JdbcResultRow row = new JdbcResultRow(); row.setFieldValue("testField", new Integer(111), Types.VARCHAR); {/* ww w . ja v a 2s .co m*/ String translated = translator.translate(row, 0); assertEquals("111", translated); } { String translated = translator.translate(row, "testField"); assertEquals("111", translated); } }
From source file:edu.northwestern.bioinformatics.studycalendar.xml.writers.ReorderXmlSerializer.java
protected void setAdditionalProperties(final Element element, Change change) { super.setAdditionalProperties(element, change); ((Reorder) change).setOldIndex(new Integer(element.attributeValue(OLD_INDEX))); ((Reorder) change).setNewIndex(new Integer(element.attributeValue(NEW_INDEX))); }
From source file:org.davidmendoza.demo.config.MailConfig.java
@Bean public JavaMailSender mailSender() { JavaMailSenderImpl mailSender = new JavaMailSenderImpl(); mailSender.setDefaultEncoding("UTF-8"); mailSender.setHost(mailHost);//from w w w. j av a 2 s . co m mailSender.setPort(new Integer(mailPort)); return mailSender; }
From source file:dao.ColStreamBlobUpdateQuery.java
public void run(Connection conn, String entryid, String collabrumid, String zoom, String btitle, String caption) throws BaseDaoException { Integer myZoom = 100;//from ww w .j a v a 2 s .com if (!RegexStrUtil.isNull(zoom)) { myZoom = new Integer(zoom); } byte[] capBytes = { ' ' }; if (!RegexStrUtil.isNull(caption)) { capBytes = caption.getBytes(); } try { PreparedStatement stmt = conn.prepareStatement("update collblob set caption=?, btitle='" + btitle + "',zoom=" + myZoom + " where entryid=" + entryid + " and collabrumid=" + collabrumid + ""); stmt.setBytes(1, capBytes); stmt.executeUpdate(); } catch (Exception e) { throw new BaseDaoException("Error occured while executing update collblob ", e); } }
From source file:com.yahoo.egads.models.adm.ExtremeLowDensityModel.java
public ExtremeLowDensityModel(Properties config) { super(config); if (config.getProperty("MAX_ANOMALY_TIME_AGO") == null) { throw new IllegalArgumentException("MAX_ANOMALY_TIME_AGO is NULL"); }//from w w w . jav a 2 s.c o m this.maxHrsAgo = new Integer(config.getProperty("MAX_ANOMALY_TIME_AGO")); this.threshold = parseMap(config.getProperty("THRESHOLD")); if (config.getProperty("THRESHOLD") != null && this.threshold.isEmpty() == true) { throw new IllegalArgumentException("THRESHOLD PARSE ERROR"); } }
From source file:de.tudarmstadt.ukp.wikipedia.api.CategoryGraphManager.java
public static CategoryGraph getCategoryGraph(Wikipedia wiki, Set<Integer> pageIds, boolean serialize) throws WikiApiException { if (catGraphMap == null) { catGraphMap = new HashMap<String, CategoryGraph>(); }//from www . j a v a2 s.c om String wikiID = wiki.getWikipediaId(); if (catGraphMap.containsKey(wikiID)) { return catGraphMap.get(wikiID); } String size = ""; if (pageIds != null) { size = new Integer(pageIds.size()).toString(); } CategoryGraph catGraph; if (serialize) { catGraph = tryToLoadCategoryGraph(wiki, wikiID, size); if (catGraph != null) { catGraphMap.put(wikiID, catGraph); return catGraph; } } // could not be loaded (= no serialized category graph was written so far) => create it if (pageIds != null) { catGraph = new CategoryGraph(wiki, pageIds); } else { catGraph = new CategoryGraph(wiki); } catGraphMap.put(wikiID, catGraph); if (serialize) { saveCategoryGraph(catGraph, wikiID, size); } return catGraph; }
From source file:net.sourceforge.fenixedu.presentationTier.validator.form.ValidateDate.java
public static boolean validate(Object bean, ValidatorAction va, Field field, ActionMessages errors, HttpServletRequest request, ServletContext application) { String valueString = ValidatorUtils.getValueAsString(bean, field.getProperty()); String sProperty2 = ValidatorUtils.getValueAsString(bean, field.getVarValue("month")); String sProperty3 = ValidatorUtils.getValueAsString(bean, field.getVarValue("day")); if (((valueString == null) && (sProperty2 == null) && (sProperty3 == null)) || ((valueString.length() == 0) && (sProperty2.length() == 0) && (sProperty3.length() == 0))) { // errors.add(field.getKey(),Resources.getActionError(request, va, // field)); return true; }//from www . java 2 s. com Integer year = null; Integer month = null; Integer day = null; try { year = new Integer(valueString); month = new Integer(sProperty2); day = new Integer(sProperty3); } catch (NumberFormatException e) { errors.add(field.getKey(), Resources.getActionMessage(request, va, field)); return false; } if (!GenericValidator.isBlankOrNull(valueString)) { if (!Data.validDate(day, month, year) || year == null || month == null || day == null || year.intValue() < 1 || month.intValue() < 0 || day.intValue() < 1) { errors.add(field.getKey(), Resources.getActionMessage(request, va, field)); } return false; } return true; }
From source file:com.enonic.cms.business.MockSitePropertiesService.java
public Integer getPropertyAsInteger(String key, SiteKey siteKey) { String svalue = getProperty(key, siteKey); if (svalue != null && !StringUtils.isNumeric(svalue)) { throw new NumberFormatException( "Invalid value of property " + key + " = " + svalue + " in site-" + siteKey + ".properties"); }//from w ww.j a v a 2s . com return svalue == null ? null : new Integer(svalue); }
From source file:core.sample.pool.PoolWorker.java
public void run() { try {/*from www.j a v a 2s . c om*/ // log.debug("**** Running Tester Thread = " + id); WorkerThread rt1 = (WorkerThread) pool.borrowObject(); Object synObj = new Object(); Object[] params = new Object[] { "Hello", new Integer(id) }; Class[] parmTypes = new Class[] { String.class, int.class }; rt1.execute("com.findonnet.services.pooling.test.SampleWork", "executeTask", params, parmTypes, synObj); // rt1.execute("com.findonnet.services.pooling.test.SampleWork", // "executeTask", null, null, synObj); synchronized (synObj) { synObj.wait(); } pool.returnObject(rt1); // log.debug("*** Finished Thread " + id); } catch (Exception e) { log.error("", e); } }
From source file:jGW2API.util.guild.GuildNotFoundException.java
public GuildNotFoundException(JSONObject json) { this.error = new Integer(json.getInt("error")); this.product = new Integer(json.getInt("product")); this.module = new Integer(json.getInt("module")); this.line = new Integer(json.getInt("line")); this.text = json.optString("text"); }