예제 #1
0
  /**
   * Create an object. The content type defaults to application/octet-stream.
   *
   * @param riak Riak instance this object is associated with, which is used by the convenience
   *     methods in this class (e.g. {@link RiakObject#store()}).
   * @param bucket The object's bucket
   * @param key The object's key
   * @param value The object's value
   * @param contentType The object's content type which defaults to application/octet-stream if
   *     null.
   * @param links Links to other objects
   * @param userMetaData Custom metadata key-value pairs for this object
   * @param vclock An opaque vclock assigned by Riak
   * @param lastmod The last time this object was modified according to Riak
   * @param vtag This object's entity tag assigned by Riak
   */
  public RiakObject(
      RiakClient riak,
      String bucket,
      String key,
      byte[] value,
      String contentType,
      List<RiakLink> links,
      Map<String, String> userMetaData,
      String vclock,
      String lastmod,
      String vtag,
      @SuppressWarnings("rawtypes") List<RiakIndex> indexes) {
    this.riak = riak;
    this.bucket = bucket;
    this.key = key;
    this.vclock = vclock;
    this.lastmod = lastmod;
    this.vtag = vtag;

    safeSetValue(value);
    this.contentType = contentType == null ? Constants.CTYPE_OCTET_STREAM : contentType;
    safeSetLinks(links);
    safeSetUsermetaData(userMetaData);
    safeSetIndexes(indexes);
  }