code: public synchronized <T> T putAttachment(final AttachmentKey<T> key, final T value) {
          Assert.checkNotNullParam("key", key);
          return key.cast(attachments.put(key, key.cast(value)));
      }
docs: {@inheritDoc}