List of usage examples for java.lang Number intValue
public abstract int intValue();
From source file:net.cyberninjapiggy.apocalyptic.misc.UUIDFetcher.java
public Map<String, UUID> call() throws Exception { Map<String, UUID> uuidMap = new HashMap<>(); String body = buildBody(names); for (int i = 1; i < MAX_SEARCH; i++) { HttpURLConnection connection = createConnection(i); writeBody(connection, body);/*from w ww . jav a 2 s . c o m*/ JSONObject jsonObject = (JSONObject) jsonParser .parse(new InputStreamReader(connection.getInputStream())); JSONArray array = (JSONArray) jsonObject.get("profiles"); Number count = (Number) jsonObject.get("size"); if (count.intValue() == 0) { break; } for (Object profile : array) { JSONObject jsonProfile = (JSONObject) profile; String id = (String) jsonProfile.get("id"); String name = (String) jsonProfile.get("name"); UUID uuid = UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" + id.substring(20, 32)); uuidMap.put(name, uuid); } } return uuidMap; }
From source file:com.ruihu.easyshop.user.dao.UserDao.java
public boolean findByUidAndPassword(String uid, String password) throws SQLException { String sql = "select count(1) from t_user where uid=? and loginpass=?"; Number number = (Number) qr.query(sql, new ScalarHandler(), uid, password); return number.intValue() > 0; //find result }
From source file:me.sonarbeserk.lockup.utils.UUIDFetcher.java
public Map<String, UUID> call() throws Exception { Map<String, UUID> uuidMap = new HashMap<String, UUID>(); String body = buildBody(names); for (int i = 1; i < MAX_SEARCH; i++) { HttpURLConnection connection = createConnection(i); writeBody(connection, body);/*from w w w . jav a2s. c om*/ JSONObject jsonObject = (JSONObject) jsonParser .parse(new InputStreamReader(connection.getInputStream())); JSONArray array = (JSONArray) jsonObject.get("profiles"); Number count = (Number) jsonObject.get("size"); if (count.intValue() == 0) { break; } for (Object profile : array) { JSONObject jsonProfile = (JSONObject) profile; String id = (String) jsonProfile.get("id"); String name = (String) jsonProfile.get("name"); UUID uuid = UUID.fromString(id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" + id.substring(20, 32)); uuidMap.put(name, uuid); } } return uuidMap; }
From source file:MutableInt.java
public void setValue(Number v) { this._value = v.intValue(); }
From source file:io.github.moosbusch.lumpi.gui.form.editor.binding.spi.AbstractButtonFormEditorBindMapping.java
@Override public State toState(Object value) { if (value != null) { if (value instanceof Boolean) { if ((Boolean) value) { return State.SELECTED; } else { return State.UNSELECTED; }//from w w w . j a va 2s.c o m } else if (value instanceof Number) { Number n = (Number) value; if (n.intValue() == -1) { return State.UNSELECTED; } else if (n.intValue() == 0) { return State.MIXED; } else if (n.intValue() == 1) { return State.SELECTED; } } else if (value instanceof String) { if (StringUtils.equalsIgnoreCase(value.toString(), State.UNSELECTED.toString())) { return State.UNSELECTED; } else if (StringUtils.equalsIgnoreCase(value.toString(), State.SELECTED.toString())) { return State.SELECTED; } else if (StringUtils.equalsIgnoreCase(value.toString(), State.MIXED.toString())) { return State.MIXED; } } } return State.UNSELECTED; }
From source file:MutableInt.java
public void add(Number operand) { this._value += operand.intValue(); }
From source file:MutableInt.java
public void subtract(Number operand) { this._value -= operand.intValue(); }
From source file:main.java.net.bornil.db.service.jdbc.JdbcEventDao.java
@Override public int createEvent(Event event) { SimpleJdbcInsert insertEvent = new SimpleJdbcInsert(this.jdbcTemplate).withTableName("EVENT") .usingColumns("EVT_STATUS", "EVT_CLASS", "EVT_CREATED_BY", "EVT_CREATED_ON") .usingGeneratedKeyColumns("EVT_ID"); Map<String, Object> args = new HashMap<String, Object>(4); args.put("EVT_STATUS", 1100); args.put("EVT_CLASS", event.getEvtClass()); args.put("EVT_CREATED_BY", "MaMuN"); args.put("EVT_CREATED_ON", new Date()); Number newId = insertEvent.executeAndReturnKey(args); event.setEvtId(newId.intValue()); return event.getEvtId(); }
From source file:com.pet.demo.repository.jdbc.JdbcVisitRepositoryImpl.java
public void save(Visit visit) throws DataAccessException { if (visit.isNew()) { Number newKey = this.insertVisit.executeAndReturnKey(createVisitParameterSource(visit)); visit.setId(newKey.intValue()); } else {/*from www. j a v a2s. c om*/ throw new UnsupportedOperationException("Visit update not supported"); } }
From source file:com.gargoylesoftware.htmlunit.javascript.host.NamespaceCollection.java
/** * Returns the namespace at the specified index. * @param index the index of the namespace (either the numeric index, or the name of the namespace) * @return the namespace at the specified index *//*from ww w. jav a 2 s . c om*/ @JsxFunction public final Object item(final Object index) { if (index instanceof Number) { final Number n = (Number) index; final int i = n.intValue(); return get(i, this); } final String key = String.valueOf(index); return get(key, this); }