/** * Returns the deserialized object. * @return The deserialized object. * @throws IllegalStateException If the object has not been deserialized. */ public T get() { if (!isDeserialized()) { throw new IllegalStateException("Object not deserialized."); } return object; }
/** * Returns the deserialized object. * @param deserialize A value indicating whether the object should be * deserialized if it is not already. * @return The deserialized object. * @throws ClassNotFoundException If a required class could not be found * during deserialization. * @throws IllegalStateException If the object has not been deserialized * and <code>deserialize</code> is false. */ public T get(boolean deserialize) throws ClassNotFoundException { if (!isDeserialized()) { if (deserialize) { deserialize(); } else { throw new IllegalStateException("Object not deserialized."); } } return object; }