Overview | Package | Class | Use | Tree | Deprecated | Index
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.emf.ecp.common.spi.asserts
Class Assert<T>

    java.lang.Object
      org.eclipse.emf.ecp.common.spi.asserts.Assert<T>

Type Parameters:
  `T` - the type of the object the `Assert` class verifies.

    public final class Assert<T>

extends Object

Class for checking the validity of a provided object.

Since:
  1.6
Author:
  Alexandra Buzila

Method Summary
`T` | `check()` Usage example: `Assert.create(Object object).notNull().ofClass(Class clazz).check()`.
`static
`<T> Assert<T>`
` | `create(T object)`
`Assert<T>` | `notNull()` Checks if the object is null, in which case an `IllegalArgumentException` is thrown.
`Assert<?>` | `ofClass(Class<?> clazz)` Checks if the object has a different type than the Class provided as parameter, in which case an `IllegalArgumentException` is thrown.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### create

    public static <T> Assert<T> create(T object)

  Type Parameters:
    `T` - the type of the object the `Assert` class verifies.
  Parameters:
    `object` - the object that will be checked
  Returns:
    a new instance of the `Assert` class.

### notNull

    public Assert<T> notNull()

  Checks if the object is null, in which case an `IllegalArgumentException` is thrown.

  Returns:
    the `Assert` instance, when no exception is thrown.

### ofClass

    public Assert<?> ofClass(Class<?> clazz)

  Checks if the object has a different type than the Class provided as parameter, in which case an `IllegalArgumentException` is thrown.

  Parameters:
    `clazz` - the `Class` against which the type of the object is checked.
  Returns:
    the `Assert` instance, when no exception is thrown.

### check

    public T check()

  Usage example:
  `Assert.create(Object object).notNull().ofClass(Class clazz).check()`.

  Returns:
    the object for which the `Assert` is created.

Overview | Package | Class | Use | Tree | Deprecated | Index
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2015. All Rights Reserved.