org.inria.ns.reflex.util
Class UserData

java.lang.Object
  extended by org.inria.ns.reflex.util.UserData
All Implemented Interfaces:
Unwrappable

public class UserData
extends Object
implements Unwrappable

A basic container for wrapping a user data.

Author:
Philippe Poulard

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.inria.ns.reflex.structures.Unwrappable
Unwrappable.Unwrapper
 
Field Summary
 
Fields inherited from interface org.inria.ns.reflex.structures.Unwrappable
UNWRAPPER
 
Constructor Summary
UserData()
           
 
Method Summary
 int getLength()
          The length of the user data if relevant.
 void setLength(int length)
          Set the length of the user data.
 void setUserData(Object userData)
          Set the user data.
 Object unwrap()
          Return the user data.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserData

public UserData()
Method Detail

setUserData

public void setUserData(Object userData)
Set the user data.

Parameters:
userData - The user data, can be null.

unwrap

public Object unwrap()
Return the user data.

Specified by:
unwrap in interface Unwrappable
Returns:
The user data, can be null.

getLength

public int getLength()
The length of the user data if relevant.

By default it is not relevant.

Returns:
-1 if the length of the user data is not relevant, its length otherwise.

setLength

public void setLength(int length)
Set the length of the user data.

To make the length irrelevant, set -1.

Parameters:
length - The length of the user data.