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 DumpFuncInfo(m interface{}) []byte
- func DumpMethodInfo(i interface{}) []byte
- func Equals(a, b interface{}) bool
- func GetFunc() *runtime.Func
- func IsCloneable(obj interface{}) bool
- func IsNil(obj interface{}) bool
- func IsNilable(obj interface{}) (canBeNil bool)
- func IsZero(obj interface{}) bool
- func NoneNil(obj interface{}) bool
- func RequireEqual(actual, expected interface{}, msg ...string) interface{}
- func RequireNonNil(obj interface{}, msg ...string) interface{}
- func RequireNonNull(obj interface{}, msg ...string) interface{}
- func RequireNonNullElse(obj, defaultObj interface{}) interface{}
- func RequireNonNullElseGet(obj interface{}, sup interface{ ... }) interface{}
- func ToString(o interface{}, nullDefault ...string) string
- type Comparator
- type ErrorMissMatch
- type ErrorNilPointer
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 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 IsZero ¶
func IsZero(obj interface{}) bool
IsZero reports whether a value is a zero value of its kind. If value.Kind() is Struct, it traverses each field of the struct recursively calling IsZero, returning true only if each field's IsZero result is also true.
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 RequireNonNull ¶
func RequireNonNull(obj interface{}, msg ...string) interface{}
grammer surgar for RequireNonNil
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{}, sup interface{ Get() interface{} }) 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
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
preconditions
Utility methods to check if state or arguments are correct.
|
Utility methods to check if state or arguments are correct. |