Documentation ¶
Overview ¶
object consists of {@code static} utility methods for operating on objects, or checking certain conditions before operation. These utilities include {@code null}-safe or {@code null}-tolerant methods for computing the hashmap code of an object, returning a string for an object, comparing two objects, and checking if indexes or sub-range values are out-of-bounds.
Index ¶
- func CheckFromIndexSize(fromIndex, size, length int) int
- func CheckFromToIndex(fromIndex, toIndex, length int) int
- func CheckIndex(index, length int) int
- func Compare(a, b interface{}, compare Comparator) int
- func DeepClone(obj interface{}) (copy interface{})
- func DeepEquals(a, b interface{}) bool
- func Equals(a, b interface{}) bool
- func GetStruct() *runtime.Func
- func IsCloneable(obj interface{}) bool
- func IsEmptyValue(obj interface{}) bool
- func IsNil(obj interface{}) bool
- func IsNilable(obj interface{}) (canBeNil bool)
- func NoneNil(obj interface{}) bool
- func RequireEqual(actual, expected interface{}, msg ...string) interface{}
- func RequireNonNil(obj interface{}, msg ...string) interface{}
- func RequireNonNullElse(obj, defaultObj interface{}) interface{}
- func RequireNonNullElseGet(obj interface{}, supplier Supplier) interface{}
- func ToString(o interface{}, nullDefault ...string) string
- type Comparator
- type ErrorMissMatch
- type ErrorNilPointer
- type Supplier
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckFromIndexSize ¶
Checks if the sub-range from {@code fromIndex} (inclusive) to {@code fromIndex + size} (exclusive) is within the bounds of range from {@code 0} (inclusive) to {@code length} (exclusive).
func CheckFromToIndex ¶
Checks if the sub-range from {@code fromIndex} (inclusive) to {@code toIndex} (exclusive) is within the bounds of range from {@code 0} (inclusive) to {@code length} (exclusive).
func CheckIndex ¶
Checks if the {@code index} is within the bounds of the range from {@code 0} (inclusive) to {@code length} (exclusive).
func Compare ¶
func Compare(a, b interface{}, compare Comparator) int
Returns 0 if the arguments are identical and {@code c.compare(a, b)} otherwise. Consequently, if both arguments are {@code null} 0 is returned.
func DeepClone ¶
func DeepClone(obj interface{}) (copy interface{})
DeepCopys returns a interface consisting of the deeply copying elements. just clone public&clonable elems - upper case - name & IsCloneable()==true
func DeepEquals ¶
func DeepEquals(a, b interface{}) bool
DeepEquals Returns {@code true} if the arguments are deeply equal to each other and {@code false} otherwise.
func Equals ¶
func Equals(a, b interface{}) bool
Equals Returns {@code true} if the arguments are equal to each other and {@code false} otherwise.
func IsCloneable ¶
func IsCloneable(obj interface{}) bool
IsCloneable Returns {@code true} if the arguments are a chan or func field or pointer to chan or func and {@code false} otherwise.
func IsEmptyValue ¶
func IsEmptyValue(obj interface{}) bool
func IsNil ¶
func IsNil(obj interface{}) bool
IsNil returns {@code true} if the provided reference is {@code nil} otherwise returns {@code false}.
func IsNilable ¶
func IsNilable(obj interface{}) (canBeNil bool)
IsNil returns {@code true} if the provided reference can be assigned {@code nil} otherwise returns {@code false}.
func NoneNil ¶
func NoneNil(obj interface{}) bool
IsNil returns {@code true} if the provided reference is non-{@code nil} otherwise returns {@code false}.
func RequireEqual ¶
func RequireEqual(actual, expected interface{}, msg ...string) interface{}
RequireNonNil checks that the specified object reference is not {@code nil}. This method is designed primarily for doing parameter validation in methods and constructors
func RequireNonNil ¶
func RequireNonNil(obj interface{}, msg ...string) interface{}
RequireNonNil checks that the specified object reference is not {@code nil}. This method is designed primarily for doing parameter validation in methods and constructors
func RequireNonNullElse ¶
func RequireNonNullElse(obj, defaultObj interface{}) interface{}
RequireNonNullElse returns the first argument if it is non-{@code nil} and otherwise returns the non-{@code nil} second argument.
func RequireNonNullElseGet ¶
func RequireNonNullElseGet(obj interface{}, supplier Supplier) interface{}
RequireNonNullElseGet returns the first argument if it is non-{@code nil} and returns the non-{@code nil} value of {@code supplier.Get()}.
Types ¶
type Comparator ¶
type Comparator interface {
Compare(a, b interface{}) int
}
type ErrorMissMatch ¶
type ErrorMissMatch error
type ErrorNilPointer ¶
type ErrorNilPointer error