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.apache.hadoop.hive.ql.udf.UDFOPDivide.java

public Byte evaluate(Byte a, Byte b) {
    // LOG.info("Get input " + a.getClass() + ":" + a + " " + b.getClass() + ":" + b);
    if ((a == null) || (b == null))
        return null;

    return Byte.valueOf((byte) (a / b));
}

From source file:org.apache.hadoop.hive.ql.udf.UDFOPMultiply.java

public Byte evaluate(Byte a, Byte b) {
    // LOG.info("Get input " + a.getClass() + ":" + a + " " + b.getClass() + ":" + b);
    if ((a == null) || (b == null))
        return null;

    return Byte.valueOf((byte) (a * b));
}

From source file:controller.FAQManagerController.java

private void initData(ModelMap mm) {
    Vector data = new Vector();
    Vector column = new Vector();
    List<Faq> list = faqModel.getAll();
    if (list.size() == 0) {
        Faq f = new Faq("Auto Generate", "Auto Generate", Byte.valueOf("0"));
        faqModel.addOrUpdate(f);// w  ww .j av  a2s.com
        list.add(f);
    }

    column.add("ID");
    column.add("Question");
    column.add("Answer");
    column.add("Status");
    for (Faq f : list) {
        Vector tmp = new Vector();
        tmp.add(f.getFaqId());
        tmp.add(f.getFaqQestion());
        tmp.add(f.getFaqAnswer());
        tmp.add(f.getStatus() == 1 ? "Active" : "Non-Active");
        tmp.add("id://" + f.getFaqId());
        data.add(tmp);
    }
    mm.put("column", column);
    mm.put("data", data);

}

From source file:org.apache.hadoop.hive.ql.udf.UDFToByte.java

public Byte evaluate(Long i) {
    if (i == null) {
        return null;
    } else {//from  w w w . ja v a  2  s  .  c o m
        return Byte.valueOf(i.byteValue());
    }
}

From source file:com.wabacus.system.datatype.ByteType.java

public Object getColumnValue(ResultSet rs, int iindex, AbsDatabaseType dbtype) throws SQLException {
    return Byte.valueOf(rs.getByte(iindex));
}

From source file:org.droidparts.inner.converter.ByteConverter.java

@Override
protected <G1, G2> Byte parseFromString(Class<Byte> valType, Class<G1> genericArg1, Class<G2> genericArg2,
        String str) {//from w ww .j a  va 2  s .  c o m
    return Byte.valueOf(str);
}

From source file:org.apache.hadoop.hive.ql.udf.UDFToByte.java

public Byte evaluate(Float i) {
    if (i == null) {
        return null;
    } else {//from   w w w . j a v a  2 s. c om
        return Byte.valueOf(i.byteValue());
    }
}

From source file:controller.DistributorManagerController.java

private void initData(ModelMap mm) {
    Vector data = new Vector();
    Vector column = new Vector();
    List<Distributor> list = disModel.getAll();
    if (list.size() == 0) {
        Distributor dis = new Distributor("Auto genarate", "Auto genarate", "Auto genarate", "Auto genarate",
                Byte.valueOf("0"), "Auto genarate", "Auto genarate", new HashSet());
        disModel.addOrUpdate(dis);//from   w w w  .  j  a  va 2s  . co  m
        list = disModel.getAll();
    }

    column.add("ID");
    column.add("Name");
    column.add("Address");
    column.add("Email");
    column.add("Phone");
    column.add("Status");

    for (Distributor dis : list) {
        Vector tmp = new Vector();
        tmp.add(dis.getDistributorId());
        tmp.add("id://" + dis.getDistributorId());
        tmp.add(dis.getDisName());
        tmp.add(dis.getDisAddress());
        tmp.add(dis.getDisEmail());
        tmp.add(dis.getDisPhone());
        tmp.add(dis.getStatus() == 1 ? "Active" : "Non-Active");
        data.add(tmp);
    }
    mm.put("column", column);
    mm.put("data", data);
}

From source file:Main.java

/**
 * parse a string to an Object of given data type. <br>
 * @param strValue the string value//from   w  w  w .  j a  va 2  s.co  m
 * @param valueType the full java class name which could be <br>
 * java.util.Date   (default format is yyyy-MM-dd) <br>
 * java.sql.Date   (default format is yyyy-MM-dd) <br>
 * java.sql.Timestamp   (default format is yyyy-MM-dd HH:mm:ss) <br>
 * java.sql.Time   (default format is HH:mm:ss) <br>
 * java.lang.String   <br>
 * java.lang.Boolean   <br>
 * java.lang.Double   <br>
 * java.lang.Long   <br>
 * java.lang.Short   <br>
 * java.lang.Integer   <br>
 * java.lang.Byte   <br>
 * java.lang.Float   <br>
 * java.math.BigInteger   <br>
 * java.math.BigDecimal   <br>
 * 
 * @param format SimpleDateFormat allowed standard formats.
 * @return Object
 * @throws Exception
 */
public static Object parseStringToObject(String strValue, String valueType, String format) throws Exception {
    if ("java.util.Date".equals(valueType)) {
        // default format yyyy-MM-dd
        SimpleDateFormat fmt = new SimpleDateFormat(format != null ? format : "yyyy-MM-dd");
        return (fmt.parse(strValue));
    } else if ("java.sql.Date".equals(valueType)) {
        // default format yyyy-MM-dd
        SimpleDateFormat fmt = new SimpleDateFormat(format != null ? format : "yyyy-MM-dd");
        return (new java.sql.Date(fmt.parse(strValue).getTime()));
    } else if ("java.sql.Timestamp".equals(valueType)) {
        // default format yyyy-MM-dd HH:mm:ss
        SimpleDateFormat fmt = new SimpleDateFormat(format != null ? format : "yyyy-MM-dd HH:mm:ss");
        return (new java.sql.Timestamp(fmt.parse(strValue).getTime()));
    } else if ("java.sql.Time".equals(valueType)) {
        // default format HH:mm:ss
        SimpleDateFormat fmt = new SimpleDateFormat(format != null ? format : "HH:mm:ss");
        return (new java.sql.Time(fmt.parse(strValue).getTime()));
    } else if ("java.lang.Boolean".equals(valueType)) {
        return (Boolean.valueOf(strValue));
    } else if ("java.lang.Double".equals(valueType)) {
        return (Double.valueOf(strValue));
    } else if ("java.lang.Long".equals(valueType)) {
        return (Long.valueOf(strValue));
    } else if ("java.lang.Short".equals(valueType)) {
        return (Short.valueOf(strValue));
    } else if ("java.lang.Integer".equals(valueType)) {
        return (Integer.valueOf(strValue));
    } else if ("java.lang.Byte".equals(valueType)) {
        return (Byte.valueOf(strValue));
    } else if ("java.lang.Float".equals(valueType)) {
        return (Float.valueOf(strValue));
    } else if ("java.math.BigInteger".equals(valueType)) {
        return (new java.math.BigInteger(strValue));
    } else if ("java.math.BigDecimal".equals(valueType)) {
        return (new java.math.BigDecimal(strValue));
    } else {
        return (strValue);
    }
}

From source file:org.apache.hadoop.hive.ql.udf.UDFToByte.java

public Byte evaluate(Double i) {
    if (i == null) {
        return null;
    } else {/*from  w  w w.  java 2  s . com*/
        return Byte.valueOf(i.byteValue());
    }
}