com.google.inject.util
Class Objects

java.lang.Object
  extended by com.google.inject.util.Objects

public class Objects
extends java.lang.Object

Object utilities.

Author:
crazybob@google.com (Bob Lee)

Constructor Summary
Objects()
           
 
Method Summary
static void assertNoNulls(java.lang.Object[] objects)
          We use this as a sanity check immediately before injecting into a method or constructor, to make sure we aren't supplying a null.
static boolean equal(java.lang.Object a, java.lang.Object b)
          null-aware equals.
static
<T> T
nonNull(T t, java.lang.String message)
          Detects null values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Objects

public Objects()
Method Detail

nonNull

public static <T> T nonNull(T t,
                            java.lang.String message)
Detects null values.

Parameters:
t - value
message - to display in the event of a null
Returns:
t

equal

public static boolean equal(java.lang.Object a,
                            java.lang.Object b)
null-aware equals.


assertNoNulls

public static void assertNoNulls(java.lang.Object[] objects)
We use this as a sanity check immediately before injecting into a method or constructor, to make sure we aren't supplying a null. This should never happen because we should have caught the problem earlier. Perhaps this should be used with Java asserts...



Copyright © 2008. All Rights Reserved.