List of usage examples for java.lang Number intValue
public abstract int intValue();
From source file:com.ruihu.easyshop.user.dao.UserDao.java
/** * check email list//www . j a va 2 s . c o m * @param email * @return * @throws SQLException */ public boolean ajaxValidateEmail(String email) throws SQLException { String sql = "select count(1) from t_user where email=?"; Number number = (Number) qr.query(sql, new ScalarHandler(), email); //check user list if it equal 0, return null return number.intValue() == 0; }
From source file:com.haulmont.chile.core.datatypes.impl.AdaptiveNumberDatatype.java
protected Number requestedType(Number number) { if (type.equals(Integer.class)) return number.intValue(); if (type.equals(Long.class)) return number.longValue(); if (type.equals(Double.class)) return number.doubleValue(); if (type.equals(Float.class)) return number.floatValue(); return number; }
From source file:com.branded.holdings.qpc.repository.jdbc.JdbcPetRepositoryImpl.java
@Override public void save(Pet pet) throws DataAccessException { if (pet.isNew()) { Number newKey = this.insertPet.executeAndReturnKey(createPetParameterSource(pet)); pet.setId(newKey.intValue()); } else {//from www. j av a2s. c o m this.namedParameterJdbcTemplate .update("UPDATE pets SET name=:name, birth_date=:birth_date, type_id=:type_id, " + "owner_id=:owner_id WHERE id=:id", createPetParameterSource(pet)); } }
From source file:com.rambird.miles.repository.jdbc.JdbcMileRepositoryImpl.java
@Override public void save(MyMile mile) throws DataAccessException { BeanPropertySqlParameterSource parameterSource = new BeanPropertySqlParameterSource(mile); Authentication auth = SecurityContextHolder.getContext().getAuthentication(); mile.setUserName(auth.getName()); //get logged in username if (mile.isNew()) { Number newKey = this.insertMile.executeAndReturnKey(parameterSource); mile.setMileId(newKey.intValue()); } else {//from w w w. ja v a 2 s . c o m this.namedParameterJdbcTemplate.update( "UPDATE mymiles SET catg=:catg, milestone=:milestone, user_name=:userName WHERE mileid=:mileId", parameterSource); } }
From source file:com.rambird.miles.repository.jdbc.JdbcCatgRepositoryImpl.java
@Override public void save(Category category) throws DataAccessException { BeanPropertySqlParameterSource parameterSource = new BeanPropertySqlParameterSource(category); Authentication auth = SecurityContextHolder.getContext().getAuthentication(); category.setUserName(auth.getName()); //get logged in username if (category.isNew()) { Number newKey = this.insertMileCatg.executeAndReturnKey(parameterSource); category.setCatgid(newKey.intValue()); } else {// w w w. j a va 2 s . c o m this.namedParameterJdbcTemplate.update( "UPDATE category SET catg=:catg, catg_label=:catgLabel, home=:home WHERE catgid=:catgid", parameterSource); } }
From source file:org.sakaiproject.evaluation.tool.reporting.LikertPercentageItemLabelGenerator.java
public String generateLabel(CategoryDataset dataset, int series, int category) { Number value = dataset.getValue(series, category); if (value == null) return ""; double doubleVal = value.doubleValue(); int intVal = value.intValue(); if (doubleVal == 0.0) { return "0 % (0)"; } else if (totalItems != 0) { double percentage = doubleVal / doubleTotalItems * 100; // return percentage + " % (" + intVal + ")"; // return String.format("%.2f %s (%s)", percentage,"%", intVal+""); return String.format("%.0f %s (%s)", percentage, "%", intVal + ""); } else if (value != null) { return value.toString(); }/*from ww w .j a va 2 s . c o m*/ return ""; }
From source file:com.pet.demo.repository.jdbc.JdbcOwnerRepositoryImpl.java
public void save(Owner owner) throws DataAccessException { BeanPropertySqlParameterSource parameterSource = new BeanPropertySqlParameterSource(owner); if (owner.isNew()) { Number newKey = this.insertOwner.executeAndReturnKey(parameterSource); owner.setId(newKey.intValue()); } else {//from w ww .ja v a 2 s. c om this.namedParameterJdbcTemplate .update("UPDATE owners SET first_name=:firstName, last_name=:lastName, address=:address, " + "city=:city, telephone=:telephone WHERE id=:id", parameterSource); } }
From source file:com.dojo.parkinglot.dao.VehicleDaoImpl.java
public Integer saveVehicle(VehicleInterface vehicle) { Map<String, Object> parameters = new HashMap<>(); parameters.put("licensePlate", vehicle.getLicensePlate()); parameters.put("type", vehicle.getType().toString()); Number key = insert_vehicle.executeAndReturnKey(parameters); LOG.debug(String.format("Generated db key on saving vehicle: %s", key)); return key.intValue(); }
From source file:MutableInt.java
public int compareTo(Number other) { final int thisVal = _value; final int anotherVal = other.intValue(); return thisVal < anotherVal ? -1 : (thisVal == anotherVal ? 0 : 1); }
From source file:net.imglib2.script.analysis.Histogram.java
public Histogram(final Object fn, final Number nBins) throws Exception { this(fn, nBins.intValue()); }