Example usage for java.lang Integer Integer

List of usage examples for java.lang Integer Integer

Introduction

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

Prototype

@Deprecated(since = "9")
public Integer(String s) throws NumberFormatException 

Source Link

Document

Constructs a newly allocated Integer object that represents the int value indicated by the String parameter.

Usage

From source file:com.pontorural.pedidovenda.converter.PessoaConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    Pessoal retorno = null;//from   w w  w  .  ja  v a2 s.c  o  m

    if (StringUtils.isNotEmpty(value)) {
        Integer codigo = new Integer(value);
        retorno = pessoas.porId(codigo);
    }

    return retorno;
}

From source file:com.ixcode.framework.model.lookup.LookupContext.java

public void registerLookup(Lookup lookup) {
    if (log.isDebugEnabled()) {
        log.debug("<registerLookup> : registering lookup with id " + lookup.getId() + " model '"
                + lookup.getSourceModelXPath() + "' property '" + lookup.getPropertyName() + "'");
    }/* w  w  w . java  2 s. co m*/
    _lookups.put(new Integer(lookup.getId()), lookup);
}

From source file:com.pontorural.pedidovenda.converter.CondicaoConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    Condicao retorno = null;/*  w w  w  .  jav  a 2 s  .c  om*/

    if (StringUtils.isNotEmpty(value)) {
        Integer codigo = new Integer(value);
        retorno = condicoes.porId(codigo);
    }

    return retorno;
}

From source file:com.pontorural.pedidovenda.converter.OperacaoConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    Operacao retorno = null;//  www  .  ja v  a2  s. c o  m

    if (StringUtils.isNotEmpty(value)) {
        Integer codigo = new Integer(value);
        retorno = operacoes.porId(codigo);
    }

    return retorno;
}

From source file:com.pontorural.pedidovenda.converter.ParceiroConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    Parceiro retorno = null;/*from w w w .  ja v a2s .  c  o  m*/

    if (StringUtils.isNotEmpty(value)) {
        Integer codigo = new Integer(value);
        retorno = parceiros.porId(codigo);
    }

    return retorno;
}

From source file:com.pontorural.pedidovenda.converter.EmpresaConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    Empresa retorno = null;/*from  ww w  . j  av  a 2s .  c o  m*/

    if (StringUtils.isNotEmpty(value)) {
        Integer codigo = new Integer(value);
        retorno = empresas.porId(codigo);
    }

    return retorno;
}

From source file:SimpleLayers.java

public SimpleLayers() {
    super("LayeredPane Demonstration");
    setSize(200, 150);//from  w  w w . j  av  a  2  s.c o m
    setDefaultCloseOperation(EXIT_ON_CLOSE);

    JLayeredPane lp = getLayeredPane();

    // Create 3 buttons
    JButton top = new JButton();
    top.setBackground(Color.white);
    top.setBounds(20, 20, 50, 50);
    JButton middle = new JButton();
    middle.setBackground(Color.gray);
    middle.setBounds(40, 40, 50, 50);
    JButton bottom = new JButton();
    bottom.setBackground(Color.black);
    bottom.setBounds(60, 60, 50, 50);

    // Place the buttons in different layers
    lp.add(middle, new Integer(2));
    lp.add(top, new Integer(3));
    lp.add(bottom, new Integer(1));
}

From source file:com.pontorural.pedidovenda.converter.PropriedadeConverter.java

@Override
public Object getAsObject(FacesContext context, UIComponent component, String value) {
    Propriedade retorno = null;/*from w w  w .  ja  v  a 2s. com*/

    if (StringUtils.isNotEmpty(value)) {
        Integer codigo = new Integer(value);
        retorno = propriedades.porId(codigo);
    }

    return retorno;
}

From source file:com.jklas.sample.petclinic.util.EntityUtils.java

/**
 * Look up the entity of the given class with the given id
 * in the given collection./* ww  w.j  a v  a2 s  .  co  m*/
 * @param entities the collection to search
 * @param entityClass the entity class to look up
 * @param entityId the entity id to look up
 * @return the found entity
 * @throws ObjectRetrievalFailureException if the entity was not found
 */
public static Entity getById(Collection entities, Class entityClass, int entityId)
        throws ObjectRetrievalFailureException {

    for (Iterator it = entities.iterator(); it.hasNext();) {
        Entity entity = (Entity) it.next();
        if (entity.getId().intValue() == entityId && entityClass.isInstance(entity)) {
            return entity;
        }
    }
    throw new ObjectRetrievalFailureException(entityClass, new Integer(entityId));
}

From source file:Util.java

/**
 * Returns an array of indices indicating the order the data should be sorted
 * in. Duplicate values are discarded with the first one being kept. This method
 * is useful when a number of data arrays have to be sorted based on the values in
 * some coordinate array, such as time.//  w w  w  .  j av  a  2s . c  o  m
 *
 * To convert a array of values to a sorted monooic array try: <br>
 *    double[] x;  // some 1-D array of data <br>
 *    int[] i = MathUtilities.uniqueSort(x); <br>
 *    double[] xSorted = MathUtilities.orderVector(x, i);<br><br>
 *
 * @param x An array of data that is to be sorted.
 * @return order An array of indexes such that y = Array.sort(x) and
 * y = x(order) are the same.
 */
public static final synchronized int[] uniqueSort(double[] x) {
    TreeMap tm = new TreeMap();
    for (int i = 0; i < x.length; i++) {
        Double key = new Double(x[i]);
        boolean exists = tm.containsKey(key);
        if (exists) {
            // Do nothing. Ignore duplicate keys
        } else {
            tm.put(key, new Integer(i));
        }
    }
    Object[] values = tm.values().toArray();
    int[] order = new int[values.length];
    for (int i = 0; i < values.length; i++) {
        Integer tmp = (Integer) values[i];
        order[i] = tmp.intValue();
    }
    return order;
}