Oracle® Fusion Middleware C++ API Reference for Oracle Coherence
12c (12.2.1.3.0)

E80355-01

Objects Class Reference

#include <coherence/util/Objects.hpp>

Inherits Object.

List of all members.


Detailed Description

This class consists of static NULL-safe or NULL-tolerant utility methods for operating on Objects.

Author:
phf 2015.07.10
Since:
12.2.1

Public Types

typedef spec::Handle Handle
 Objects Handle definition.
typedef spec::View View
 Objects View definition.
typedef spec::Holder Holder
 Objects Holder definition.

Static Public Member Functions

static String::View toString (Object::View v, String::View vsNullDefault)
 Returns the result of calling toString on the first argument if the first argument is not NULL and returns the second argument otherwise.
static int32_t compare (Object::View vA, Object::View vB, Comparator::View vC)
 Returns 0 if the arguments are identical and vC->compare(vA, vB) otherwise.
static Object::Holder requireNonNull (Object::Holder oh)
 Checks that the specified object reference is not NULL.
static Object::Holder requireNonNull (Object::Holder oh, String::View vsMessage)
 Checks that the specified Object reference is not NULL and throws a customized NullPointerException if it is.
static bool isNull (Object::View v)
 Returns true if the provided reference is NULL otherwise returns false.
static bool nonNull (Object::View v)
 Returns true if the provided reference is non-NULL otherwise returns false.

Member Function Documentation

static String::View toString ( Object::View  v,
String::View  vsNullDefault 
) [static]

Returns the result of calling toString on the first argument if the first argument is not NULL and returns the second argument otherwise.

Parameters:
v an Object
vsNullDefault string to return if the first argument is NULL
Returns:
the result of calling toString on the first argument if it is not NULL and the second argument otherwise.
See also:
Object::toString(Object)

static int32_t compare ( Object::View  vA,
Object::View  vB,
Comparator::View  vC 
) [static]

Returns 0 if the arguments are identical and vC->compare(vA, vB) otherwise.

Consequently, if both arguments are NULL, 0 is returned.

Note that if one of the arguments is NULL, a NullPointerException may or may not be thrown depending on what ordering policy, if any, the Comparator chooses to have for NULL values.

Parameters:
vA an Object
vB an Object to be compared with vA
vC the Comparator to compare the first two arguments
Returns:
0 if the arguments are identical and c->compare(vA, vB) otherwise.
See also:
Comparable

Comparator

static Object::Holder requireNonNull ( Object::Holder  oh  )  [static]

Checks that the specified object reference is not NULL.

This method is designed primarily for doing parameter validation in methods and constructors, as demonstrated below: <blockquote>

 protected Foo(Bar::View vBar) {
     this.vBar = Objects::requireNonNull(vBar);
 }
 
</blockquote>

Parameters:
oh the Object reference to check for nullity
Returns:
oh if not NULL
Exceptions:
NullPointerException if oh is NULL

static Object::Holder requireNonNull ( Object::Holder  oh,
String::View  vsMessage 
) [static]

Checks that the specified Object reference is not NULL and throws a customized NullPointerException if it is.

This method is designed primarily for doing parameter validation in methods and constructors with multiple parameters, as demonstrated below: <blockquote>

 protected Foo(Bar::View vBar, Baz::View vBaz) {
     this.vBar = Objects::requireNonNull(vBar, "vBar must not be null");
     this.vBaz = Objects::requireNonNull(vBaz, "vBaz must not be null");
 }
 
</blockquote>

Parameters:
oh the Object reference to check for nullity
vsMessage detail message to be used in the event that a NullPointerException is thrown
Returns:
oh if not NULL
Exceptions:
NullPointerException if oh is NULL

static bool isNull ( Object::View  v  )  [static]

Returns true if the provided reference is NULL otherwise returns false.

Parameters:
v an Object to be checked against NULL
Returns:
true if the provided reference is NULL otherwise false

static bool nonNull ( Object::View  v  )  [static]

Returns true if the provided reference is non-NULL otherwise returns false.

Parameters:
v an Object to be checked against NULL
Returns:
true if the provided reference is non-NULL otherwise false


The documentation for this class was generated from the following file:
Copyright © 2000, 2017, Oracle and/or its affiliates. All rights reserved.