Java Object to Long castToLong(Object object)

Here you can find the source of castToLong(Object object)

Description

Sometimes ELP's version of cast is misbehaving

License

GNU General Public License

Parameter

Parameter Description
object a parameter

Declaration

public static Long castToLong(Object object) 

Method Source Code

//package com.java2s;
/*/*from ww  w . j a v a 2  s  . co m*/
 Pulsar
 Copyright (C) 2013-2015 eBay Software Foundation
 Licensed under the GPL v2 license.  See LICENSE for full terms.
 */

public class Main {
    /**
     * Sometimes ELP's version of cast is misbehaving
     * 
     * @param object
     * @return
     */
    public static Long castToLong(Object object) {
        if (object != null) {
            if (object instanceof Long)
                return (Long) object;
            else
                return Long.valueOf(object.toString());
        }
        return null;
    }
}

Related

  1. castLong(Object o)
  2. castLong(Object val)
  3. castLong2Int(long x)
  4. castLongtoUInt(long x)
  5. castToLong(final String uid)
  6. castToLong(Object value)
  7. castToLong(Object value)
  8. castToLongArray(Object[] array)
  9. objectToLong(Object obj)