Example usage for java.lang Byte valueOf

List of usage examples for java.lang Byte valueOf

Introduction

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

Prototype

public static Byte valueOf(String s) throws NumberFormatException 

Source Link

Document

Returns a Byte object holding the value given by the specified String .

Usage

From source file:org.op4j.functions.FnObject.java

/**
 * <p>// ww w. ja va  2s .  c  om
 * Determines whether the target object is greater or equal to the specified object
 * in value, this is, whether <tt>target.compareTo(object) >= 0</tt>. Both
 * the target and the specified object have to implement {@link Comparable}.
 * </p>
 * 
 * @param object the object to compare to the target
 * @return true if target is greater or equal to the specified object, false if not
 */
public static final Function<Object, Boolean> greaterOrEqTo(final byte object) {
    return new GreaterOrEqualTo(Byte.valueOf(object));
}

From source file:org.apache.openjpa.kernel.StateManagerImpl.java

/**
 * Fetch the specified field from the specified field manager, wrapping it
 * in an object if it's a primitive. A field should be provided to the
 * field manager before this call is made.
 *//*  ww w. ja  v  a  2  s .  c o  m*/
private static Object fetchField(FieldManager fm, FieldMetaData fmd) {
    int field = fmd.getIndex();
    switch (fmd.getDeclaredTypeCode()) {
    case JavaTypes.BOOLEAN:
        return (fm.fetchBooleanField(field)) ? Boolean.TRUE : Boolean.FALSE;
    case JavaTypes.BYTE:
        return Byte.valueOf(fm.fetchByteField(field));
    case JavaTypes.CHAR:
        return Character.valueOf(fm.fetchCharField(field));
    case JavaTypes.DOUBLE:
        return Double.valueOf(fm.fetchDoubleField(field));
    case JavaTypes.FLOAT:
        return Float.valueOf(fm.fetchFloatField(field));
    case JavaTypes.INT:
        return fm.fetchIntField(field);
    case JavaTypes.LONG:
        return fm.fetchLongField(field);
    case JavaTypes.SHORT:
        return Short.valueOf(fm.fetchShortField(field));
    case JavaTypes.STRING:
        return fm.fetchStringField(field);
    default:
        return fm.fetchObjectField(field);
    }
}

From source file:org.op4j.functions.FnLong.java

/**
* <p>/*  w ww  .ja v a 2  s .com*/
* It divides the target element by the given divisor and returns its result
* </p>
* 
* @param divisor the divisor
* @return the result of target/divisor
*/
public final static Function<Long, Long> divideBy(byte divisor) {
    return divideBy(Byte.valueOf(divisor));
}

From source file:org.op4j.functions.FnFloat.java

/**
* <p>//from   www .j a va 2s . c  o m
* It divides the target element by the given divisor and returns its result
* </p>
* 
* @param divisor the divisor
* @return the result of target/divisor
*/
public final static Function<Float, Float> divideBy(byte divisor) {
    return divideBy(Byte.valueOf(divisor));
}

From source file:org.op4j.functions.FnShort.java

/**
* <p>/*from ww w  .jav  a 2  s  .co m*/
* It divides the target element by the given divisor and returns its result
* </p>
* 
* @param divisor the divisor
* @return the result of target/divisor
*/
public final static Function<Short, Short> divideBy(byte divisor) {
    return divideBy(Byte.valueOf(divisor));
}

From source file:com.mimp.controllers.main.java

@RequestMapping(value = "/inscSesGrp", method = RequestMethod.GET)
public ModelAndView inscSesGrp_GET(ModelMap map, HttpSession session) {
    int turno = 0;
    String estado = "";
    String nombreEl = "";
    String apellidoPEl = "";
    String apellidoMEl = "";
    String paisNacEl = "";
    String depNacEl = "";
    String proNacEl = "";
    String fechaNacEl = "";
    String edadEl = "";
    String docEl = "";
    String numDocEl = "";
    String profesionEl = "";
    String celEl = "";
    String correoEl = "";
    String nombreElla = "";
    String apellidoPElla = "";
    String apellidoMElla = "";
    String paisNacElla = "";
    String depNacElla = "";
    String proNacElla = "";
    String fechaNacElla = "";
    String edadElla = "";
    String docElla = "";
    String numDocElla = "";
    String profesionElla = "";
    String celElla = "";
    String correoElla = "";
    String pais = "";
    String dep = "";
    String prov = "";
    String dist = "";
    String dir = "";
    String telf = "";
    try {/*from w  w  w .  ja  va2 s .  c o  m*/
        turno = Integer.parseInt(session.getAttribute("turno").toString());
        estado = session.getAttribute("estado").toString();
        nombreEl = session.getAttribute("nombreEl").toString();
        apellidoPEl = session.getAttribute("apellidoPEl").toString();
        apellidoMEl = session.getAttribute("apellidoMEl").toString();
        paisNacEl = session.getAttribute("paisNacEl").toString();
        depNacEl = session.getAttribute("depNacEl").toString();
        proNacEl = session.getAttribute("proNacEl").toString();
        fechaNacEl = session.getAttribute("fechaNacEl").toString();
        edadEl = session.getAttribute("edadEl").toString();
        docEl = session.getAttribute("docEl").toString();
        numDocEl = session.getAttribute("numDocEl").toString();
        profesionEl = session.getAttribute("profesionEl").toString();
        celEl = session.getAttribute("celEl").toString();
        correoEl = session.getAttribute("correoEl").toString();
        nombreElla = session.getAttribute("nombreElla").toString();
        apellidoPElla = session.getAttribute("apellidoPElla").toString();
        apellidoMElla = session.getAttribute("apellidoMElla").toString();
        paisNacElla = session.getAttribute("paisNacElla").toString();
        depNacElla = session.getAttribute("depNacElla").toString();
        proNacElla = session.getAttribute("proNacElla").toString();
        fechaNacElla = session.getAttribute("fechaNacElla").toString();
        edadElla = session.getAttribute("edadElla").toString();
        docElla = session.getAttribute("docElla").toString();
        numDocElla = session.getAttribute("numDocElla").toString();
        profesionElla = session.getAttribute("profesionElla").toString();
        celElla = session.getAttribute("celElla").toString();
        correoElla = session.getAttribute("correoElla").toString();
        pais = session.getAttribute("pais").toString();
        dep = session.getAttribute("dep").toString();
        prov = session.getAttribute("prov").toString();
        dist = session.getAttribute("dist").toString();
        dir = session.getAttribute("dir").toString();
        telf = session.getAttribute("telf").toString();
    } catch (Exception ex) {
        return new ModelAndView("redirect:/", map);
    }
    session.removeAttribute("estado");
    session.removeAttribute("turno");
    session.removeAttribute("nombreEl");
    session.removeAttribute("apellidoPEl");
    session.removeAttribute("apellidoMEl");
    session.removeAttribute("paisNacEl");
    session.removeAttribute("depNacEl");
    session.removeAttribute("proNacEl");
    session.removeAttribute("fechaNacEl");
    session.removeAttribute("edadEl");
    session.removeAttribute("docEl");
    session.removeAttribute("numDocEl");
    session.removeAttribute("profesionEl");
    session.removeAttribute("celEl");
    session.removeAttribute("correoEl");
    session.removeAttribute("nombreElla");
    session.removeAttribute("apellidoPElla");
    session.removeAttribute("apellidoMElla");
    session.removeAttribute("paisNacElla");
    session.removeAttribute("depNacElla");
    session.removeAttribute("proNacElla");
    session.removeAttribute("fechaNacElla");
    session.removeAttribute("edadElla");
    session.removeAttribute("docElla");
    session.removeAttribute("numDocElla");
    session.removeAttribute("profesionElla");
    session.removeAttribute("celElla");
    session.removeAttribute("correoElla");
    session.removeAttribute("pais");
    session.removeAttribute("dep");
    session.removeAttribute("prov");
    session.removeAttribute("dist");
    session.removeAttribute("dir");
    session.removeAttribute("telf");

    String m = "m";
    String f = "f";
    Turno temp = ServicioMain.getTurno(turno);
    FormularioSesion fs = new FormularioSesion();
    Asistente asisEl = new Asistente();
    Asistente asisElla = new Asistente();
    AsistenciaFT aft = new AsistenciaFT();
    AsistenciaFT aft2 = new AsistenciaFT();
    fs.setSesion(temp.getSesion());
    aft.setTurno(temp);
    aft2.setTurno(temp);
    String asistencia = "F";
    char asist = asistencia.charAt(0);
    aft.setAsistencia(asist);
    aft2.setAsistencia(asist);
    String inajust = "1";
    Short i = Short.valueOf(inajust);
    aft.setInasJus(i);
    aft2.setInasJus(i);
    Date today = new Date();

    fs.setFechaSol(today);
    fs.setPaisRes(pais);
    fs.setDepRes(dep);
    fs.setProvRes(prov);
    fs.setDistritoRes(dist);
    fs.setDireccionRes(dir);
    fs.setTelefono(telf);
    fs.setEstadoCivil(estado);

    asisEl.setNombre(nombreEl);
    asisEl.setApellidoP(apellidoPEl);
    asisEl.setApellidoM(apellidoMEl);
    asisEl.setPaisNac(paisNacEl);
    asisEl.setDepNac(depNacEl);
    asisEl.setProvNac(proNacEl);
    short bEl = Byte.valueOf(edadEl);
    asisEl.setEdad(bEl);
    if (fechaNacEl != null && !fechaNacEl.equals("")) {
        asisEl.setFechaNac(df.stringToDate(fechaNacEl));
    }
    char cEl = docEl.charAt(0);
    asisEl.setTipoDoc(cEl);
    char sexoEl = m.charAt(0);
    asisEl.setSexo(sexoEl);
    asisEl.setNDoc(numDocEl);
    asisEl.setProfesion(profesionEl);
    asisEl.setCelular(celEl);
    asisEl.setCorreo(correoEl);

    asisElla.setNombre(nombreElla);
    asisElla.setApellidoP(apellidoPElla);
    asisElla.setApellidoM(apellidoMElla);
    asisElla.setPaisNac(paisNacElla);
    asisElla.setDepNac(depNacElla);
    asisElla.setProvNac(proNacElla);
    short bElla = Byte.valueOf(edadElla);
    asisElla.setEdad(bElla);
    if (fechaNacElla != null && !fechaNacElla.equals("")) {
        asisElla.setFechaNac(df.stringToDate(fechaNacElla));
    }
    char cElla = docElla.charAt(0);
    asisElla.setTipoDoc(cElla);
    char sexoElla = f.charAt(0);
    asisElla.setSexo(sexoElla);
    asisElla.setNDoc(numDocElla);
    asisElla.setProfesion(profesionElla);
    asisElla.setCelular(celElla);
    asisElla.setCorreo(correoElla);

    ArrayList<Asistente> tempList = new ArrayList();
    tempList = ServicioMain.listaAsistentes(temp.getSesion().getIdsesion());
    if (!tempList.isEmpty()) {
        for (Asistente asistente : tempList) {
            if (asistente.getNDoc().equals(numDocEl) || asistente.getNDoc().equals(numDocElla)) {
                map.put("mensaje", "inscrito");
                return new ModelAndView("/Inscripcion/inscripcion_sesion1b", map);
            }

        }
    }
    if (temp.getVacantes() > temp.getAsistenciaFTs().size() + 1) {
        map.put("ts", ts);
        map.put("turno", temp);
        ServicioMain.InsertFormGrp(asisEl, asisElla, fs, aft, aft2);
        return new ModelAndView("/Inscripcion/inscripcion_sesion4", map);
    }
    return new ModelAndView("/Inscripcion/inscripcion_sesion1b", map);
}

From source file:org.op4j.functions.FnInteger.java

/**
* <p>//  www.  ja v a 2 s.c  o m
* It divides the target element by the given divisor and returns its result
* </p>
* 
* @param divisor the divisor
* @return the result of target/divisor
*/
public final static Function<Integer, Integer> divideBy(byte divisor) {
    return divideBy(Byte.valueOf(divisor));
}

From source file:it.classhidra.core.controller.bean.java

private Object getPrimitiveArgument(String name, String s_value) {

    Object primArgument = null;//  www.ja  va  2 s  .c  o  m
    Class reqClass = (delegated == null) ? this.getClass() : delegated.getClass();
    if (name.indexOf('.') > -1) {
        StringTokenizer st = new StringTokenizer(name, ".");
        /*
              Vector allfields=new Vector();
              while(st.hasMoreTokens())
                 allfields.add(st.nextToken());
                
                         
              String complexName="";
              for(int i=0;i<allfields.size()-1;i++){
                 complexName+=allfields.get(i);
                 if(i!=allfields.size()-2) complexName+=".";
              }
                      
              name = (String)allfields.get(allfields.size()-1);
        */

        String complexName = "";
        while (st.hasMoreTokens()) {
            String token = st.nextToken();
            if (st.countTokens() > 0)
                complexName += token;
            if (st.countTokens() > 1)
                complexName += ".";
            if (st.countTokens() == 0)
                name = token;
        }

        Object writeObj = get(complexName);
        if (writeObj == null)
            return primArgument;
        reqClass = writeObj.getClass();

    }

    try {
        java.lang.reflect.Method mtd = null;
        Class[] cls = new Class[0];

        mtd = reqClass.getMethod("get" + util_reflect.adaptMethodName(name), cls);
        if (mtd != null) {
            Class primArgumentClass = mtd.getReturnType();
            if (primArgumentClass.equals(double.class)) {
                primArgument = Double.valueOf(s_value);
            } else if (primArgumentClass.equals(int.class)) {
                primArgument = Integer.valueOf(s_value);
            } else if (primArgumentClass.equals(boolean.class)) {
                primArgument = Boolean.valueOf(s_value);
            } else if (primArgumentClass.equals(char.class)) {
                primArgument = s_value;
            } else if (primArgumentClass.equals(byte.class)) {
                primArgument = Byte.valueOf(s_value);
            } else if (primArgumentClass.equals(short.class)) {
                primArgument = Short.valueOf(s_value);
            } else if (primArgumentClass.equals(long.class)) {
                primArgument = Long.valueOf(s_value);
            } else if (primArgumentClass.equals(float.class)) {
                primArgument = Float.valueOf(s_value);
            }
        }

    } catch (Exception e) {

    }
    return primArgument;
}

From source file:org.op4j.functions.FnBigInteger.java

/**
  * <p>/*from   w w w. j  a  v  a2s.c o  m*/
  * It divides the target element by the given divisor and returns the
  * remainder (target % divisor)
  * </p>
  * 
  * @param divisor the divisor
  * @return the remainder of target/divisor
  */
public final static Function<BigInteger, BigInteger> remainder(byte divisor) {
    return remainder(Byte.valueOf(divisor));
}

From source file:org.op4j.functions.FnLong.java

/**
* <p>//w  w w  .j  a v a  2 s  .  co m
* It divides the target element by the given divisor and returns its result with the
* precision and rounding mode specified by mathContext
* </p>
* 
* @param divisor the divisor
* @param mathContext the {@link MathContext} to define {@link RoundingMode} and precision
* @return the result of target/divisor
*/
public final static Function<Long, Long> divideBy(byte divisor, MathContext mathContext) {
    return divideBy(Byte.valueOf(divisor), mathContext);
}