Objects
Attributes
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Objects.type
Members list
Type members
Classlikes
Compare Builder
Compare Builder
Attributes
- Since
-
4.2.4
- Supertypes
-
class Objecttrait Matchableclass Any
Equals Builder
Equals Builder
Attributes
- Since
-
3.1.0
- Supertypes
-
class Objecttrait Matchableclass Any
Support class for Objects.toStringBuilder.
Support class for Objects.toStringBuilder.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
Value members
Concrete methods
Compares two objects for equality, where either one or both objects may be null.
Compares two objects for equality, where either one or both objects may be null.
equals(null, null) = true
equals(null, "") = false
equals("", null) = false
equals("", "") = true
equals(Boolean.TRUE, null) = false
equals(Boolean.TRUE, "true") = false
equals(Boolean.TRUE, Boolean.TRUE) = true
equals(Boolean.TRUE, Boolean.FALSE) = false
Value parameters
- a
-
the first object, may be
null - b
-
the second object, may be
null
Attributes
- Returns
-
trueif the values of both objects are the same - Since
-
3.0
Compares two object array for equality, where either one or both objects may be null. Note: Don't user Any[_],fo after type erase ,it has same signature with equals(a:Any,b:Any)
Compares two object array for equality, where either one or both objects may be null. Note: Don't user Any[_],fo after type erase ,it has same signature with equals(a:Any,b:Any)
Attributes
Return a hex String form of an object's identity hash code.
Return a hex String form of an object's identity hash code.
Value parameters
- obj
-
the object
Attributes
- Returns
-
the object's identity code in hex notation
将传入的对象转换为非空值 如果传入的对象为null,则返回默认值
将传入的对象转换为非空值 如果传入的对象为null,则返回默认值
nvl(null, null) = null
nvl(null, "") = ""
nvl(null, "zz") = "zz"
nvl("abc", *) = "abc"
nvl(Boolean.TRUE, *) = Boolean.TRUE
Value parameters
- default
-
如果
s为null时返回的默认值 - s
-
需要检查的对象
Attributes
- Returns
-
转换后的非空值
Gets the toString of an Object returning an empty string ("") if null input.
Gets the toString of an Object returning an empty string ("") if null input.
toString(null) = ""
toString("") = ""
toString("bat") = "bat"
toString(Boolean.TRUE) = "true"
Value parameters
- obj
-
the Object to
toString, may be null
Attributes
- Returns
-
the passed in Object's toString, or nullStr if
nullinput - See also
-
String#valueOf(Object)
- Since
-
3.0
Creates an instance of [[ToStringBuilder]].
Creates an instance of [[ToStringBuilder]].
This is helpful for implementing Object#toString(). Specification by example:
// Returns "ClassName{}"
Objects.toStringBuilder(this)
.toString();
// Returns "ClassName{x=1}"
Objects.toStringBuilder(this)
.add("x", 1)
.toString();
// Returns "MyObject{x=1}"
Objects.toStringBuilder("MyObject")
.add("x", 1)
.toString();
// Returns "ClassName{x=1, y=foo}"
Objects.toStringBuilder(this)
.add("x", 1)
.add("y", "foo")
.toString();
}}
// Returns "ClassName{x=1}"
Objects.toStringBuilder(this)
.omitNullValues()
.add("x", 1)
.add("y", null)
.toString();
Value parameters
- self
-
the object to generate the string for (typically
this), used only for its class name
Attributes
- Since
-
3.1
Creates an instance of ToStringBuilder in the same manner as toStringBuilder(AnyRef), but using the name of clazz instead of using an instance's Object#getClass().
Creates an instance of ToStringBuilder in the same manner as toStringBuilder(AnyRef), but using the name of clazz instead of using an instance's Object#getClass().
Value parameters
- clazz
-
the Class of the instance
Attributes
Creates an instance of ToStringBuilder in the same manner as toStringBuilder(AnyRef), but using className instead of using an class instance.
Creates an instance of ToStringBuilder in the same manner as toStringBuilder(AnyRef), but using className instead of using an class instance.
Value parameters
- className
-
the name of the instance type