object

package
v1.0.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2019 License: MIT Imports: 8 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFromIndexSize

func CheckFromIndexSize(fromIndex, size, length int) int

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

func CheckFromToIndex(fromIndex, toIndex, length int) int

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

func CheckIndex(index, length int) int

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 GetStruct

func GetStruct() *runtime.Func

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()}.

func ToString

func ToString(o interface{}, nullDefault ...string) string

Returns the result of calling {@code toString} on the first argument if the first argument is not {@code null} and returns the second argument otherwise.

Types

type Comparator

type Comparator interface {
	Compare(a, b interface{}) int
}

type ErrorMissMatch

type ErrorMissMatch error

type ErrorNilPointer

type ErrorNilPointer error

type Supplier

type Supplier interface {
	Get() interface{}
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL