Example usage for java.lang Integer intValue

List of usage examples for java.lang Integer intValue

Introduction

In this page you can find the example usage for java.lang Integer intValue.

Prototype

@HotSpotIntrinsicCandidate
public int intValue() 

Source Link

Document

Returns the value of this Integer as an int .

Usage

From source file:com.redhat.rhn.domain.monitoring.command.IntegerValidator.java

/**
 * {@inheritDoc}/*  ww w.j  a  va 2  s .  co m*/
 */
public boolean inRange(String value) {
    if (value == null) {
        return true;
    }
    int i = Integer.parseInt(value);
    Integer min = getParam().getMinValue();
    Integer max = getParam().getMaxValue();
    return ((min == null || min.intValue() <= i) && (max == null || i <= max.intValue()));
}

From source file:com.sworddance.util.TestPredicatedTransformingIterator.java

public void testSimple() {
    PredicatedTransformingIterator<Integer> transformingIterator = new PredicatedTransformingIterator<Integer>(
            ints);// w w  w  . j  a  v  a2 s.  c  o m
    int j = 0;
    for (Integer i : transformingIterator) {
        assertEquals(j++, i.intValue());
    }
    assertEquals(ints.size(), j);
}

From source file:com.alibaba.sample.petstore.dal.dao.ibatis.IbatisProductItemDao.java

public boolean isItemInStock(String itemId) {
    Integer i = (Integer) getSqlMapClientTemplate().queryForObject("getInventoryQuantity", itemId);

    return i != null && i.intValue() > 0;
}

From source file:tr.edu.gsu.peralab.mobilesensing.web.service.CustomUserDetailsService.java

/**
 * @param role/* ww w. j a v  a 2  s  . c o  m*/
 * @return Credentials of the given role number
 */
public List<String> getRoles(Integer role) {
    List<String> roles = new ArrayList<String>();
    if (role.intValue() == 1) {
        roles.add("ROLE_USER");
        roles.add("ROLE_ADMIN");
    } else if (role.intValue() == 0) {
        roles.add("ROLE_USER");
    }
    return roles;
}

From source file:org.awesomeagile.dao.DatabaseIntegrationTest.java

@Test
public void testPostgres() throws Exception {
    JdbcTemplate jdbcTemplate = testDatabase.jdbcTemplate();
    int random = RandomUtils.nextInt(1000);
    Integer integer = jdbcTemplate.queryForObject("select " + random, Integer.class);
    assertEquals(random, integer.intValue());
}

From source file:com.sworddance.util.TestPredicatedTransformingIterator.java

public void testFiltering() {
    PredicatedTransformingIterator<Integer> transformingIterator = new PredicatedTransformingIterator<Integer>(
            ints);/*from   w  w w .j a  v  a2 s . c  o  m*/
    transformingIterator.setPredicate(predicate);
    int j = 0;
    int k = 0;
    for (Integer i : transformingIterator) {
        assertEquals(j, i.intValue());
        j += 2;
        k++;
    }
    assertEquals(ints.size() / 2, k);
}

From source file:net.orpiske.ssps.common.db.AbstractDao.java

/**
 * Runs an UPDATE/INSERT/DELETE statement
 * @param query The query (statement) to run
 * @param args The arguments to the query
 * @return The number of affected rows//from   w  w w  .  j av a 2 s.c  om
 * @throws SQLException If unable to perform the operation
 */
protected int runQueryCount(String query, Object... args) throws SQLException {
    Connection conn = databaseManager.getConnection();

    QueryRunner run = new QueryRunner();
    CountRsHandler rs = new CountRsHandler();

    Integer count = run.query(conn, query, rs, args);
    return count.intValue();
}

From source file:com.katropine.services.CustomUserDetailsService.java

public List<String> getRoles(Integer role) {

    List<String> roles = new ArrayList<String>();

    if (role.intValue() == 1) {
        roles.add("ROLE_ADMINISTRATOR");
    } else if (role.intValue() == 2) {
        roles.add("ROLE_USER");
    }//ww  w.  j  av  a  2 s . c om
    return roles;
}

From source file:com.org.services.impl.UserServiceImpl.java

/**
 * /* w  w  w  . j  a  v a  2s  .  c o  m*/
 * @see com.org.services.UserService#findById(java.lang.Integer)
 */
@Override
public Users findById(Integer id) throws DaoException {
    logger.debug("find user dao");
    if (id == null || id.intValue() <= 0) {
        return null;
    }
    try {
        userDao = new UserDaoImpl(persistenceUnit, dbName);
        return userDao.findById(id);
    } catch (DaoException e) {
        logger.error("Error ", e);
        return null;
    }
}

From source file:com.github.bysrhq.belajar.web.SeedStarterMngController.java

@RequestMapping(value = "/seedstartermng", params = { "removeRow" })
public String removeRow(SeedStarter seedStarter, BindingResult bindingResult, HttpServletRequest request) {
    Integer rowId = Integer.valueOf(request.getParameter("removeRow"));
    seedStarter.getRows().remove(rowId.intValue());

    return "seedstartermng";
}