org.exoplatform.commons.utils
Class Safe

java.lang.Object
  extended by org.exoplatform.commons.utils.Safe

public class Safe
extends java.lang.Object

A class that contains utility method that make the caller not worry much about the unexpectable expected such as argument nullity or the control flow due to exceptions.

Version:
$Revision$
Author:
Julien Viet

Method Summary
static boolean close(java.io.Closeable closeable)
          Close a closable object.
static boolean equals(java.lang.Object o1, java.lang.Object o2)
          Return true if both objects are null or both are non null and the equals method of one object returns true when it is invoked with the other object as argument.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

equals

public static boolean equals(java.lang.Object o1,
                             java.lang.Object o2)
Return true if both objects are null or both are non null and the equals method of one object returns true when it is invoked with the other object as argument.

Parameters:
o1 - the first object
o2 - the second object
Returns:
true if string are safely equal

close

public static boolean close(java.io.Closeable closeable)
Close a closable object. The provided object may be null or thrown an IOException or a runtime exception during the invocation of the close method without changing the control flow of the method caller. If the closeable was succesfully closed the method returns true.

Parameters:
closeable - the closeable
Returns:
true if the object was closed


Copyright © 2010 eXo Platform SAS. All Rights Reserved.