ref_send API 2.17
defensive programming in Java

org.ref_send.brand
Class Brand<T>

java.lang.Object
  extended by org.ref_send.brand.Brand<T>
Type Parameters:
T - purpose of this brand
All Implemented Interfaces:
java.io.Serializable, Immutable, Powerless

public class Brand<T>
extends java.lang.Object
implements Powerless, java.io.Serializable

An opaque, globally unique identifier.

See Also:
Serialized Form

Method Summary
static
<P> boolean
equal(P a, P b)
          Is one object equal to another?
static
<T> Brand<T>
make()
          Constructs an instance.
static
<T> void
require(Brand<T> expected, Brand<T> actual)
          Requires that one brand is the same as another.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

make

public static <T> Brand<T> make()
Constructs an instance.

Type Parameters:
T - purpose of this brand

equal

public static <P> boolean equal(P a,
                                P b)
Is one object equal to another?

Type Parameters:
P - compared object type
Parameters:
a - object compared against
b - object compared to
Returns:
true if a claims b is equal, else false

require

public static <T> void require(Brand<T> expected,
                               Brand<T> actual)
                    throws WrongBrand
Requires that one brand is the same as another.

Type Parameters:
T - purpose of this brand
Parameters:
expected - brand compared against
actual - brand compared to
Throws:
WrongBrand - actual is not expected

ref_send API 2.17
defensive programming in Java

Submit a bug or feature, or get help

Copyright 1998-2009 Waterken Inc. under the terms of the MIT X license.