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

## org.jdesktop.swingx.util
Class Contract

    java.lang.Object
      org.jdesktop.swingx.util.Contract

    public class Contract

extends java.lang.Object

Utility class for checking contracts.

Author:
  Jeanette Winzenburg

Method Summary
`static
`<T> T`
` | `asNotNull(T input, java.lang.String message)` Tests the input parameter against null.

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

Method Detail

### asNotNull

    public static <T> T asNotNull(T input,
                                  java.lang.String message)

  Tests the input parameter against null. If the input is an array, checks all of its elements as well. Returns the unchanged parameter if not null, throws a NullPointerException otherwise.

  PENDING: type of exception? there are raging debates, some favour an IllegalArgument?

  PENDING: the implementation uses a unchecked type cast to an array. can we do better, how?

  Type Parameters:
    `T` - the type of the input parameter
  Parameters:
    `input` - the argument to check against null.
    `message` - the text of the exception if the argument is null
  Returns:
    the input if not null
  Throws:
    `java.lang.NullPointerException` - if input is null

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

Copyright © 2010. All Rights Reserved.