org.fuin.objects4j
Class Contract

java.lang.Object
  extended by org.fuin.objects4j.Contract

public final class Contract
extends Object

Utility class for assertions on objects.


Method Summary
static void requireArgNotNull(String name, Object value)
          Checks if the value is not null.
static void requireValid(Object value)
          Checks if the given value is valid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

requireArgNotNull

public static void requireArgNotNull(String name,
                                     Object value)
                              throws ContractViolationException
Checks if the value is not null.

Parameters:
name - Name of the value for a possible error message.
value - Value to check.
Throws:
ContractViolationException - The value was null.

requireValid

public static void requireValid(Object value)
                         throws ContractViolationException
Checks if the given value is valid.

Parameters:
value - Value to check.
Throws:
ContractViolationException - The value is invalid.


Copyright © 2011 Future Invent Informationsmanagement GmbH. All Rights Reserved.