亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? formatconverter.java

?? 一個java方面的消息訂閱發(fā)送的源碼
?? JAVA
字號:
/**
 * Redistribution and use of this software and associated documentation
 * ("Software"), with or without modification, are permitted provided
 * that the following conditions are met:
 *
 * 1. Redistributions of source code must retain copyright
 *    statements and notices.  Redistributions must also contain a
 *    copy of this document.
 *
 * 2. Redistributions in binary form must reproduce the
 *    above copyright notice, this list of conditions and the
 *    following disclaimer in the documentation and/or other
 *    materials provided with the distribution.
 *
 * 3. The name "Exolab" must not be used to endorse or promote
 *    products derived from this Software without prior written
 *    permission of Exoffice Technologies.  For written permission,
 *    please contact info@exolab.org.
 *
 * 4. Products derived from this Software may not be called "Exolab"
 *    nor may "Exolab" appear in their names without prior written
 *    permission of Exoffice Technologies. Exolab is a registered
 *    trademark of Exoffice Technologies.
 *
 * 5. Due credit should be given to the Exolab Project
 *    (http://www.exolab.org/).
 *
 * THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
 * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
 * EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * Copyright 2000,2001 (C) Exoffice Technologies Inc. All Rights Reserved.
 *
 * $Id: FormatConverter.java,v 1.1 2004/11/26 01:50:43 tanderson Exp $
 *
 * Date         Author  Changes
 * 02/26/2000   jimm    Created
 */

package org.exolab.jms.message;

// jms

import javax.jms.JMSException;
import javax.jms.MessageFormatException;


/**
 * A simple format converter to help convert an Object type as per the
 * table listed below.
 *
 * <P>A value written as the row type can be read as the column type.
 *
 * <PRE>
 * |        | boolean byte short char int long float double String byte[]
 * |----------------------------------------------------------------------
 * |boolean |    X                                            X
 * |byte    |          X     X         X   X                  X
 * |short   |                X         X   X                  X
 * |char    |                     X                           X
 * |int     |                          X   X                  X
 * |long    |                              X                  X
 * |float   |                                    X     X      X
 * |double  |                                          X      X
 * |String  |    X     X     X         X   X     X     X      X
 * |byte[]  |                                                        X
 * |----------------------------------------------------------------------
 * </PRE>
 *
 * <P>Attempting to read a null value as a Java primitive type must be treated
 * as calling the primitive's corresponding <code>valueOf(String)</code>
 * conversion method with a null value. Since char does not support a String
 * conversion, attempting to read a null value as a char must throw
 * NullPointerException.
 *
 * @version     $Revision: 1.1 $ $Date: 2004/11/26 01:50:43 $
 * @author      <a href="mailto:mourikis@intalio.com">Jim Mourikis</a>
 * @author      <a href="mailto:tima@intalio.com">Tim Anderson</a>
 */
class FormatConverter {

    /**
     * Convert value to boolean
     *
     * @param value the object to convert from
     * @return the converted boolean
     * @throws MessageFormatException if the conversion is invalid
     */
    public static boolean getBoolean(Object value)
        throws MessageFormatException {
        boolean result = false;

        if (value instanceof Boolean) {
            result = ((Boolean) value).booleanValue();
        } else if (value instanceof String) {
            result = Boolean.valueOf((String) value).booleanValue();
        } else if (value == null) {
            result = Boolean.valueOf((String) value).booleanValue();
        } else {
            raise(value, boolean.class);
        }
        return result;
    }

    /**
     * Convert value to byte
     *
     * @param value the object to convert from
     * @return the converted byte
     * @throws MessageFormatException if the conversion is invalid
     * @throws NumberFormatException if value is a String and the conversion
     * is invalid
     */
    public static byte getByte(Object value) throws MessageFormatException {
        byte result = 0;

        if (value instanceof Byte) {
            result = ((Byte) value).byteValue();
        } else if (value instanceof String) {
            result = Byte.parseByte((String) value);
        } else if (value == null) {
            result = Byte.valueOf((String) value).byteValue();
        } else {
            raise(value, byte.class);
        }
        return result;
    }


    /**
     * Convert value to short
     *
     * @param value the object to convert from
     * @return the converted short
     * @throws MessageFormatException if the conversion is invalid
     * @throws NumberFormatException if value is a String and the conversion
     * is invalid
     */
    public static short getShort(Object value) throws MessageFormatException {
        short result = 0;

        if (value instanceof Short) {
            result = ((Short) value).shortValue();
        } else if (value instanceof Byte) {
            result = ((Byte) value).shortValue();
        } else if (value instanceof String) {
            result = Short.parseShort((String) value);
        } else if (value == null) {
            result = Short.valueOf((String) value).shortValue();
        } else {
            raise(value, short.class);
        }
        return result;
    }

    /**
     * Convert value to char
     *
     * @param value the object to convert from
     * @return the converted char
     * @throws MessageFormatException if the conversion is invalid
     * @throws NullPointerException if value is null
     */
    public static char getChar(Object value) throws MessageFormatException {
        char result = '\0';
        if (value instanceof Character) {
            result = ((Character) value).charValue();
        } else if (value == null) {
            throw new NullPointerException(
                "Cannot convert null value to char");
        } else {
            raise(value, char.class);
        }
        return result;
    }

    /**
     * Convert value to int
     *
     * @param value the object to convert from
     * @return the converted int
     * @throws MessageFormatException if the conversion is invalid
     * @throws NumberFormatException if value is a String and the conversion
     * is invalid
     */
    public static int getInt(Object value) throws MessageFormatException {
        int result = 0;

        if (value instanceof Integer) {
            result = ((Integer) value).intValue();
        } else if (value instanceof Short) {
            result = ((Short) value).intValue();
        } else if (value instanceof Byte) {
            result = ((Byte) value).intValue();
        } else if (value instanceof String) {
            result = Integer.parseInt((String) value);
        } else if (value == null) {
            result = Integer.valueOf((String) value).intValue();
        } else {
            raise(value, int.class);
        }
        return result;
    }


    /**
     * Convert value to long
     *
     * @param value the object to convert from
     * @return the converted long
     * @throws MessageFormatException if the conversion is invalid
     * @throws NumberFormatException if value is a String and the conversion
     * is invalid
     */
    public static long getLong(Object value) throws MessageFormatException {
        long result = 0;

        if (value instanceof Long) {
            result = ((Long) value).longValue();
        } else if (value instanceof Integer) {
            result = ((Integer) value).longValue();
        } else if (value instanceof Short) {
            result = ((Short) value).longValue();
        } else if (value instanceof Byte) {
            result = ((Byte) value).longValue();
        } else if (value instanceof String) {
            result = Long.parseLong((String) value);
        } else if (value == null) {
            result = Long.valueOf((String) value).longValue();
        } else {
            raise(value, long.class);
        }
        return result;
    }

    /**
     * Convert value to float
     *
     * @param value the object to convert from
     * @return the converted float
     * @throws MessageFormatException if the conversion is invalid
     * @throws NumberFormatException if value is a String and the conversion
     * is invalid
     */
    public static float getFloat(Object value) throws MessageFormatException {
        float result = 0;

        if (value instanceof Float) {
            result = ((Float) value).floatValue();
        } else if (value instanceof String) {
            result = Float.parseFloat((String) value);
        } else if (value == null) {
            result = Float.valueOf((String) value).floatValue();
        } else {
            raise(value, float.class);
        }
        return result;
    }

    /**
     * Convert value to double
     *
     * @param value the object to convert from
     * @return the converted double
     * @throws MessageFormatException if the conversion is invalid
     * @throws NumberFormatException if value is a String and the conversion
     * is invalid
     */
    public static double getDouble(Object value)
        throws MessageFormatException {
        double result = 0;

        if (value instanceof Double) {
            result = ((Double) value).doubleValue();
        } else if (value instanceof Float) {
            result = ((Float) value).doubleValue();
        } else if (value instanceof String) {
            result = Double.parseDouble((String) value);
        } else if (value == null) {
            result = Double.valueOf((String) value).doubleValue();
        } else {
            raise(value, double.class);
        }
        return result;
    }

    /**
     * Convert value to String
     *
     * @param value the object to convert from
     * @return the converted String
     * @throws MessageFormatException if the conversion is invalid
     */
    public static String getString(Object value)
        throws MessageFormatException {
        if (value instanceof byte[]) {
            raise(value, String.class);
        }
        return (value == null) ? null : String.valueOf(value);
    }

    /**
     * Convert value to byte[]
     *
     * @param value the object to convert from. This must be a byte array, or
     * null
     * @return a copy of the supplied array, or null
     * @throws MessageFormatException if value is not a byte array or is not
     * null
     */
    public static byte[] getBytes(Object value)
        throws MessageFormatException {
        byte[] result = null;

        if (value instanceof byte[]) {
            byte[] bytes = (byte[]) value;
            result = new byte[bytes.length];
            System.arraycopy(bytes, 0, result, 0, bytes.length);
        } else if (value != null) {
            raise(value, byte[].class);
        }
        return result;
    }

    /**
     * Helper to raise a MessageFormatException when a conversion cannot be
     * performed
     *
     * @param value the value that cannot be converted
     * @param type the type that the value cannot be converted to
     * @throws MessageFormatException when invoked
     */
    private static void raise(Object value, Class type)
        throws MessageFormatException {

        throw new MessageFormatException(
            "Cannot convert values of type " + value.getClass().getName() +
            " to " + type.getName());
    }

} //-- FormatConverter

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
强制捆绑调教一区二区| 综合激情网...| 免费观看成人av| 日韩一级免费一区| 精品综合免费视频观看| 久久午夜羞羞影院免费观看| 国产精品羞羞答答xxdd| 欧美国产禁国产网站cc| www.久久久久久久久| 亚洲在线一区二区三区| 欧美丰满高潮xxxx喷水动漫| 免费视频一区二区| 2019国产精品| 99久久综合色| 亚洲成av人影院| 精品国产自在久精品国产| 国产成人在线看| 亚洲欧美国产三级| 日韩一区二区免费电影| 国产美女av一区二区三区| 国产精品久久午夜| 欧美三片在线视频观看| 国产一区二三区好的| 亚洲同性gay激情无套| 777奇米成人网| 国产91对白在线观看九色| 亚洲欧美激情视频在线观看一区二区三区 | 丝袜脚交一区二区| 精品av久久707| 色婷婷精品大在线视频| 久久成人18免费观看| 亚洲欧洲国产日本综合| 欧美电视剧免费观看| 91麻豆成人久久精品二区三区| 日韩vs国产vs欧美| 1区2区3区国产精品| 91精品国产91热久久久做人人| 国产一区二区三区精品欧美日韩一区二区三区| 中文字幕一区视频| 欧美一区午夜精品| 91免费观看视频| 看国产成人h片视频| 亚洲激情六月丁香| 久久色视频免费观看| 91在线国产福利| 精品中文字幕一区二区| 午夜视频在线观看一区| 《视频一区视频二区| 精品精品欲导航| 在线观看免费一区| 成人app软件下载大全免费| 日本不卡高清视频| 亚洲一区二区三区激情| 日本一区二区三区高清不卡| 欧美一级淫片007| 97久久超碰国产精品| 国产福利不卡视频| 久久av资源站| 午夜电影一区二区| 中文字幕色av一区二区三区| 国产午夜精品一区二区三区视频 | 欧美日韩在线播放一区| 成人免费视频视频在线观看免费| 日本特黄久久久高潮| 亚洲综合图片区| 亚洲免费伊人电影| 国产精品国产三级国产aⅴ中文| 久久久久97国产精华液好用吗| 欧美一级午夜免费电影| 91精品欧美综合在线观看最新| 在线免费亚洲电影| 一本色道久久综合精品竹菊| 99久久久久免费精品国产| 成人影视亚洲图片在线| 成人精品一区二区三区四区| 国产成人一级电影| 高清beeg欧美| 成人动漫中文字幕| 99视频有精品| 91亚洲午夜精品久久久久久| 91网站在线播放| 色综合久久久久网| 在线观看国产91| 欧美老女人第四色| 欧美另类一区二区三区| 欧美日本一区二区三区| 51精品视频一区二区三区| 欧美一级理论性理论a| 日韩欧美国产三级电影视频| 日韩一级精品视频在线观看| 2020国产精品自拍| 国产欧美一区二区三区网站| 国产精品久久久久久亚洲伦| 亚洲激情综合网| 亚洲国产一区二区在线播放| 免费在线视频一区| 国产一区不卡精品| 91一区一区三区| 欧美在线|欧美| 欧美一区二区久久久| 26uuu亚洲综合色欧美| 亚洲国产精品传媒在线观看| 亚洲精品第1页| 日本成人在线一区| 国产成人亚洲综合a∨婷婷图片| 99精品1区2区| 欧美精品在线视频| 欧美精品一区二区高清在线观看| 国产欧美一区二区精品性| 亚洲人精品一区| 日韩高清一区在线| 不卡欧美aaaaa| 欧美主播一区二区三区美女| 欧美电影免费观看高清完整版在| 日本一区二区动态图| 亚洲一区欧美一区| 久久99精品一区二区三区三区| 成人黄色免费短视频| 欧美高清视频不卡网| 久久久久久9999| 亚洲午夜影视影院在线观看| 精品无码三级在线观看视频| 日本久久一区二区三区| 日韩视频免费观看高清完整版在线观看 | 麻豆高清免费国产一区| 国产宾馆实践打屁股91| 欧美人狂配大交3d怪物一区| 国产亚洲一二三区| 男女男精品视频网| av中文一区二区三区| 日韩美女视频在线| 亚洲福中文字幕伊人影院| 国产乱一区二区| 7777精品伊人久久久大香线蕉| 日本一区二区三区免费乱视频| 无码av中文一区二区三区桃花岛| 丁香天五香天堂综合| 日韩午夜中文字幕| 一区二区理论电影在线观看| 国产一区美女在线| 91精品蜜臀在线一区尤物| 中文字幕一区视频| 国产成人精品亚洲777人妖| 6080日韩午夜伦伦午夜伦| 亚洲人成伊人成综合网小说| 国产一区二区三区四| 欧美一区二区三区在| 亚洲成人你懂的| 色呦呦日韩精品| 国产精品第13页| 成人小视频免费观看| 亚洲精品一区二区三区蜜桃下载| 亚洲 欧美综合在线网络| 一本色道久久综合亚洲精品按摩| 日本一区二区三区视频视频| 国产综合久久久久久鬼色| 欧美一级免费观看| 日本一不卡视频| 欧美另类z0zxhd电影| 亚洲www啪成人一区二区麻豆| 一本到不卡免费一区二区| 国产精品第13页| 99在线精品一区二区三区| 最近日韩中文字幕| av一区二区三区| 中文字幕一区三区| 白白色亚洲国产精品| 中文字幕亚洲一区二区av在线| 国产mv日韩mv欧美| 欧美国产激情二区三区| 成人一区二区视频| 1000部国产精品成人观看| 91理论电影在线观看| 亚洲欧美怡红院| 91首页免费视频| 亚洲伦理在线精品| 欧美日韩在线综合| 日韩有码一区二区三区| 欧美精品三级日韩久久| 日韩中文字幕麻豆| 欧美精品一区二区三区在线播放| 蜜桃av一区二区在线观看| 久久综合五月天婷婷伊人| 国产又黄又大久久| 日韩美女精品在线| 国产拍欧美日韩视频二区| 亚洲小说欧美激情另类| 成人高清视频在线观看| 亚洲日本在线视频观看| 欧美色图天堂网| 日韩av一区二区三区| 日韩精品一区二区在线观看| 国内精品伊人久久久久av影院 | 国产精品1区2区| 国产精品久久久久9999吃药| 91啪在线观看| 日韩精品乱码av一区二区| 欧美videos中文字幕| eeuss鲁片一区二区三区在线观看| 亚洲欧美区自拍先锋|