org.openide.util.io
Class NbMarshalledObject

java.lang.Object
  extended by org.openide.util.io.NbMarshalledObject
All Implemented Interfaces:
java.io.Serializable

public final class NbMarshalledObject
extends java.lang.Object
implements java.io.Serializable

Object that holds serialized reference to another object. Inspired by java.rmi.MarshalledObject but modified to work with NetBeans and its modules. So no annotations are stored with the bytestream and when the object is deserialized it is assumed to be produced by some installed module.

See Also:
Serialized Form

Constructor Summary
NbMarshalledObject(java.lang.Object obj)
          Creates a new NbMarshalledObject that contains the serialized representation of the provided object.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Two objects are equal if the hold the same serialized representation.
 java.lang.Object get()
          Returns a new copy of the contained marshalledobject.
 int hashCode()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NbMarshalledObject

public NbMarshalledObject(java.lang.Object obj)
                   throws java.io.IOException
Creates a new NbMarshalledObject that contains the serialized representation of the provided object.

Parameters:
obj - the object to be serialized (must be serializable)
Throws:
java.io.IOException - the object is not serializable
Method Detail

get

public java.lang.Object get()
                     throws java.io.IOException,
                            java.lang.ClassNotFoundException
Returns a new copy of the contained marshalledobject. The object is deserialized by NbObjectInputStream, so it is assumed that it can be located in some module.

Returns:
a copy of the contained object
Throws:
java.io.IOException - on any I/O problem
java.lang.ClassNotFoundException - if the class of the object cannot be found

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object
Returns:
a hash code

equals

public boolean equals(java.lang.Object obj)
Two objects are equal if the hold the same serialized representation.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare with this MarshalledObject
Returns:
true if the objects are serialized into the same bytestreams