Example usage for java.lang Byte Byte

List of usage examples for java.lang Byte Byte

Introduction

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

Prototype

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

Source Link

Document

Constructs a newly allocated Byte object that represents the byte value indicated by the String parameter.

Usage

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstOracle.CFAstOracleSchema.java

public static Byte getNullableByte(ResultSet reader, int colidx) {
    try {// w  ww.ja  v a  2 s.c om
        byte val = reader.getByte(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Byte(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFAstOracleSchema.class, "getNullableByte", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfinternet.v2_1.CFInternetMSSql.CFInternetMSSqlSchema.java

public static Byte getNullableByte(ResultSet reader, int colidx) {
    try {//  www  .ja  v  a  2 s  .  co m
        byte val = reader.getByte(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Byte(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFInternetMSSqlSchema.class, "getNullableByte",
                e);
    }
}

From source file:org.apache.axis2.databinding.utils.ConverterUtil.java

public static Object getAnyTypeObject(XMLStreamReader xmlStreamReader, Class extensionMapperClass)
        throws XMLStreamException {
    Object returnObject = null;//from   w  w  w  . j  av a 2  s.  c o m

    // make sure reader is at the first element.
    while (!xmlStreamReader.isStartElement()) {
        xmlStreamReader.next();
    }
    // first check whether this element is null or not
    String nillableValue = xmlStreamReader.getAttributeValue(Constants.XSI_NAMESPACE, "nil");
    if ("true".equals(nillableValue) || "1".equals(nillableValue)) {
        returnObject = null;
        xmlStreamReader.next();
    } else {
        String attributeType = xmlStreamReader.getAttributeValue(Constants.XSI_NAMESPACE, "type");
        if (attributeType != null) {
            String attributeTypePrefix = "";
            if (attributeType.indexOf(":") > -1) {
                attributeTypePrefix = attributeType.substring(0, attributeType.indexOf(":"));
                attributeType = attributeType.substring(attributeType.indexOf(":") + 1);
            }
            NamespaceContext namespaceContext = xmlStreamReader.getNamespaceContext();
            String attributeNameSpace = namespaceContext.getNamespaceURI(attributeTypePrefix);

            if (Constants.XSD_NAMESPACE.equals(attributeNameSpace)) {
                if ("base64Binary".equals(attributeType)) {
                    returnObject = XMLStreamReaderUtils.getDataHandlerFromElement(xmlStreamReader);
                } else {
                    String attribValue = xmlStreamReader.getElementText();
                    if (attribValue != null) {
                        if (attributeType.equals("string")) {
                            returnObject = attribValue;
                        } else if (attributeType.equals("int")) {
                            returnObject = new Integer(attribValue);
                        } else if (attributeType.equals("QName")) {
                            String namespacePrefix = null;
                            String localPart = null;
                            if (attribValue.indexOf(":") > -1) {
                                namespacePrefix = attribValue.substring(0, attribValue.indexOf(":"));
                                localPart = attribValue.substring(attribValue.indexOf(":") + 1);
                                returnObject = new QName(namespaceContext.getNamespaceURI(namespacePrefix),
                                        localPart);
                            }
                        } else if ("boolean".equals(attributeType)) {
                            returnObject = new Boolean(attribValue);
                        } else if ("anyURI".equals(attributeType)) {
                            try {
                                returnObject = new URI(attribValue);
                            } catch (URI.MalformedURIException e) {
                                throw new XMLStreamException("Invalid URI");
                            }
                        } else if ("date".equals(attributeType)) {
                            returnObject = ConverterUtil.convertToDate(attribValue);
                        } else if ("dateTime".equals(attributeType)) {
                            returnObject = ConverterUtil.convertToDateTime(attribValue);
                        } else if ("time".equals(attributeType)) {
                            returnObject = ConverterUtil.convertToTime(attribValue);
                        } else if ("byte".equals(attributeType)) {
                            returnObject = new Byte(attribValue);
                        } else if ("short".equals(attributeType)) {
                            returnObject = new Short(attribValue);
                        } else if ("float".equals(attributeType)) {
                            returnObject = new Float(attribValue);
                        } else if ("long".equals(attributeType)) {
                            returnObject = new Long(attribValue);
                        } else if ("double".equals(attributeType)) {
                            returnObject = new Double(attribValue);
                        } else if ("decimal".equals(attributeType)) {
                            returnObject = new BigDecimal(attribValue);
                        } else if ("unsignedLong".equals(attributeType)) {
                            returnObject = new UnsignedLong(attribValue);
                        } else if ("unsignedInt".equals(attributeType)) {
                            returnObject = new UnsignedInt(attribValue);
                        } else if ("unsignedShort".equals(attributeType)) {
                            returnObject = new UnsignedShort(attribValue);
                        } else if ("unsignedByte".equals(attributeType)) {
                            returnObject = new UnsignedByte(attribValue);
                        } else if ("positiveInteger".equals(attributeType)) {
                            returnObject = new PositiveInteger(attribValue);
                        } else if ("negativeInteger".equals(attributeType)) {
                            returnObject = new NegativeInteger(attribValue);
                        } else if ("nonNegativeInteger".equals(attributeType)) {
                            returnObject = new NonNegativeInteger(attribValue);
                        } else if ("nonPositiveInteger".equals(attributeType)) {
                            returnObject = new NonPositiveInteger(attribValue);
                        } else {
                            throw new ADBException("Unknown type ==> " + attributeType);
                        }
                    } else {
                        throw new ADBException("Attribute value is null");
                    }
                }
            } else {
                try {
                    Method getObjectMethod = extensionMapperClass.getMethod("getTypeObject",
                            new Class[] { String.class, String.class, XMLStreamReader.class });
                    returnObject = getObjectMethod.invoke(null,
                            new Object[] { attributeNameSpace, attributeType, xmlStreamReader });
                } catch (NoSuchMethodException e) {
                    throw new ADBException(
                            "Can not find the getTypeObject method in the " + "extension mapper class ", e);
                } catch (IllegalAccessException e) {
                    throw new ADBException(
                            "Can not access the getTypeObject method in the " + "extension mapper class ", e);
                } catch (InvocationTargetException e) {
                    throw new ADBException(
                            "Can not invoke the getTypeObject method in the " + "extension mapper class ", e);
                }

            }

        } else {
            throw new ADBException("Any type element type has not been given");
        }
    }
    return returnObject;
}

From source file:net.sf.jasperreports.engine.xml.JRXmlConstants.java

/**
 * @deprecated Replaced by {@link ScaleImageEnum}.
 *//* w  w  w  .j a  v a2s  .c o  m*/
public static Map getScaleImageMap() {
    if (scaleImageMap == null) {
        Map map = new HashMap(14);
        map.put(SCALE_IMAGE_CLIP, new Byte(JRImage.SCALE_IMAGE_CLIP));
        map.put(SCALE_IMAGE_FILL_FRAME, new Byte(JRImage.SCALE_IMAGE_FILL_FRAME));
        map.put(SCALE_IMAGE_RETAIN_SHAPE, new Byte(JRImage.SCALE_IMAGE_RETAIN_SHAPE));
        map.put(SCALE_IMAGE_REAL_HEIGT, new Byte(JRImage.SCALE_IMAGE_REAL_HEIGHT));
        map.put(SCALE_IMAGE_REAL_SIZE, new Byte(JRImage.SCALE_IMAGE_REAL_SIZE));
        map.put(new Byte(JRImage.SCALE_IMAGE_CLIP), SCALE_IMAGE_CLIP);
        map.put(new Byte(JRImage.SCALE_IMAGE_FILL_FRAME), SCALE_IMAGE_FILL_FRAME);
        map.put(new Byte(JRImage.SCALE_IMAGE_RETAIN_SHAPE), SCALE_IMAGE_RETAIN_SHAPE);
        map.put(new Byte(JRImage.SCALE_IMAGE_REAL_HEIGHT), SCALE_IMAGE_REAL_HEIGT);
        map.put(new Byte(JRImage.SCALE_IMAGE_REAL_SIZE), SCALE_IMAGE_REAL_SIZE);
        scaleImageMap = Collections.unmodifiableMap(map);
    }

    return scaleImageMap;
}

From source file:net.sourceforge.msscodefactory.cfensyntax.v2_2.CFEnSyntaxMySql.CFEnSyntaxMySqlSchema.java

public static Byte getNullableByte(ResultSet reader, int colidx) {
    try {//from   w  ww  . j a va  2s.  com
        byte val = reader.getByte(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Byte(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFEnSyntaxMySqlSchema.class, "getNullableByte",
                e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskDb2LUW.CFAsteriskDb2LUWSchema.java

public static Byte getNullableByte(ResultSet reader, int colidx) {
    try {// w  w  w .  j  a v  a 2s .co  m
        byte val = reader.getByte(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Byte(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFAsteriskDb2LUWSchema.class, "getNullableByte",
                e);
    }
}

From source file:adams.data.statistics.StatUtils.java

/**
 * Turns the Number matrix into one consisting of primitive bytes.
 *
 * @param matrix   the matrix to convert
 * @return      the converted matrix/*  w  ww  .j  a v a 2s. c  o  m*/
 */
public static Number[][] toNumberMatrix(byte[][] matrix) {
    Byte[][] result;
    int i;
    int n;

    result = new Byte[matrix.length][];
    for (i = 0; i < matrix.length; i++) {
        result[i] = new Byte[matrix[i].length];
        for (n = 0; n < matrix[i].length; n++)
            result[i][n] = new Byte(matrix[i][n]);
    }

    return result;
}

From source file:net.sourceforge.msscodefactory.cfcrm.v2_1.CFCrmDb2LUW.CFCrmDb2LUWSchema.java

public static Byte getNullableByte(ResultSet reader, int colidx) {
    try {//from   www.  jav a 2  s  .  c o m
        byte val = reader.getByte(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Byte(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFCrmDb2LUWSchema.class, "getNullableByte", e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskSybase.CFAsteriskSybaseSchema.java

public static Byte getNullableByte(ResultSet reader, int colidx) {
    try {//w w w.j av a  2  s  . c om
        byte val = reader.getByte(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Byte(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFAsteriskSybaseSchema.class, "getNullableByte",
                e);
    }
}

From source file:net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskPgSql.CFAsteriskPgSqlSchema.java

public static Byte getNullableByte(ResultSet reader, int colidx) {
    try {//from ww  w . j a  va  2s. c om
        byte val = reader.getByte(colidx);
        if (reader.wasNull()) {
            return (null);
        } else {
            return (new Byte(val));
        }
    } catch (SQLException e) {
        throw CFLib.getDefaultExceptionFactory().newDbException(CFAsteriskPgSqlSchema.class, "getNullableByte",
                e);
    }
}