code: @Nullable
    public <T> T getSessionObject(@Nonnull final String key, @Nonnull final Class<T> klazz, @Nullable final T def) {
      this.lock();
      try {
        T result = klazz.cast(this.sessionObjects.get(key));
        return result == null ? def : result;
      } finally {
        this.unlock();
      }
    }
docs: Get saved session object. Object is presented and saved only for the
  current panel and only in memory.
  
  @param <T> type of object
  @param key key of object, must not be null
  @param klazz object type, must not be null
  @param def default value will be returned as result if object not
  presented, can be null
  @return null if object is not found, the found object otherwise
  @throws ClassCastException if object type is wrong for saved object
  @since 1.4.2