Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.core.runtime
Class Assert


java.lang.Object
  extended by 
org.eclipse.core.runtime.Assert

public final class Assert
extends Object

Assert is useful for for embedding runtime sanity checks in code. The predicate methods all test a condition and throw some type of unchecked exception if the condition does not hold.

Assertion failure exceptions, like most runtime exceptions, are thrown when something is misbehaving. Assertion failures are invariably unspecified behavior; consequently, clients should never rely on these being thrown (and certainly should not being catching them specifically).

This class can be used without OSGi running.

This class is not intended to be instantiated or sub-classed by clients.

Since:
org.eclipse.equinox.common 3.2
Restriction:
This class is not intended to be instantiated by clients.

Method Summary
static boolean isLegal (boolean expression)
          Asserts that an argument is legal.
static boolean isLegal (boolean expression, String message)
          Asserts that an argument is legal.
static void isNotNull ( Object object)
          Asserts that the given object is not null.
static void isNotNull ( Object object, String message)
          Asserts that the given object is not null.
static boolean isTrue (boolean expression)
          Asserts that the given boolean is true.
static boolean isTrue (boolean expression, String message)
          Asserts that the given boolean is true.
 
Methods inherited from class java.lang. Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

isLegal

public static boolean isLegal(boolean expression)
Asserts that an argument is legal. If the given boolean is not true, an IllegalArgumentException is thrown.

Parameters:
expression - the outcode of the check
Returns:
true if the check passes (does not return if the check fails)
Throws:
IllegalArgumentException - if the legality test failed

isLegal

public static boolean isLegal(boolean expression,
                              
String message)
Asserts that an argument is legal. If the given boolean is not true, an IllegalArgumentException is thrown. The given message is included in that exception, to aid debugging.

Parameters:
expression - the outcode of the check
message - the message to include in the exception
Returns:
true if the check passes (does not return if the check fails)
Throws:
IllegalArgumentException - if the legality test failed

isNotNull

public static void isNotNull(
Object object)
Asserts that the given object is not null. If this is not the case, some kind of unchecked exception is thrown.

Parameters:
object - the value to test

isNotNull

public static void isNotNull(
Object object,
                             
String message)
Asserts that the given object is not null. If this is not the case, some kind of unchecked exception is thrown. The given message is included in that exception, to aid debugging.

Parameters:
object - the value to test
message - the message to include in the exception

isTrue

public static boolean isTrue(boolean expression)
Asserts that the given boolean is true. If this is not the case, some kind of unchecked exception is thrown.

Parameters:
expression - the outcode of the check
Returns:
true if the check passes (does not return if the check fails)

isTrue

public static boolean isTrue(boolean expression,
                             
String message)
Asserts that the given boolean is true. If this is not the case, some kind of unchecked exception is thrown. The given message is included in that exception, to aid debugging.

Parameters:
expression - the outcode of the check
message - the message to include in the exception
Returns:
true if the check passes (does not return if the check fails)

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire