com.greenpineyu.fel.common
类 ObjectUtils

java.lang.Object
  继承者 com.greenpineyu.fel.common.ObjectUtils

public class ObjectUtils
extends Object


构造方法摘要
ObjectUtils()
           
 
方法摘要
static boolean equals(Object object1, Object object2)
          Compares two objects for equality, where either one or both objects may be null.
static boolean notEqual(Object object1, Object object2)
          Compares two objects for inequality, where either one or both objects may be null.
static String toString(Object obj)
          Gets the toString of an Object returning an empty string ("") if null input.
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

ObjectUtils

public ObjectUtils()
方法详细信息

equals

public static boolean equals(Object object1,
                             Object object2)

Compares two objects for equality, where either one or both objects may be null.

 ObjectUtils.equals(null, null)                  = true
 ObjectUtils.equals(null, "")                    = false
 ObjectUtils.equals("", null)                    = false
 ObjectUtils.equals("", "")                      = true
 ObjectUtils.equals(Boolean.TRUE, null)          = false
 ObjectUtils.equals(Boolean.TRUE, "true")        = false
 ObjectUtils.equals(Boolean.TRUE, Boolean.TRUE)  = true
 ObjectUtils.equals(Boolean.TRUE, Boolean.FALSE) = false
 

参数:
object1 - the first object, may be null
object2 - the second object, may be null
返回:
true if the values of both objects are the same

toString

public static String toString(Object obj)

Gets the toString of an Object returning an empty string ("") if null input.

 ObjectUtils.toString(null)         = ""
 ObjectUtils.toString("")           = ""
 ObjectUtils.toString("bat")        = "bat"
 ObjectUtils.toString(Boolean.TRUE) = "true"
 

参数:
obj - the Object to toString, may be null
返回:
the passed in Object's toString, or nullStr if null input
从以下版本开始:
2.0
另请参见:
StringUtils#defaultString(String), String.valueOf(Object)

notEqual

public static boolean notEqual(Object object1,
                               Object object2)

Compares two objects for inequality, where either one or both objects may be null.

 ObjectUtils.notEqual(null, null)                  = false
 ObjectUtils.notEqual(null, "")                    = true
 ObjectUtils.notEqual("", null)                    = true
 ObjectUtils.notEqual("", "")                      = false
 ObjectUtils.notEqual(Boolean.TRUE, null)          = true
 ObjectUtils.notEqual(Boolean.TRUE, "true")        = true
 ObjectUtils.notEqual(Boolean.TRUE, Boolean.TRUE)  = false
 ObjectUtils.notEqual(Boolean.TRUE, Boolean.FALSE) = true
 

参数:
object1 - the first object, may be null
object2 - the second object, may be null
返回:
false if the values of both objects are the same


Copyright © 2013. All Rights Reserved.