## com.baidubce.services.bos.model
Class CopyObjectRequest

    java.lang.Object
      com.baidubce.model.AbstractBceRequest
          com.baidubce.services.bos.model.GenericBucketRequest
              com.baidubce.services.bos.model.GenericObjectRequest
                  com.baidubce.services.bos.model.CopyObjectRequest

    public class CopyObjectRequest

extends GenericObjectRequest

Provides options for copying an Baidu Bos object from a source location to a new destination.

All `CopyObjectRequests` must specify a source bucket and key, along with a destination bucket and key.

Constructor Summary
`CopyObjectRequest(String sourceBucketName, String sourceKey, String bucketName, String key)` Constructs a new CopyObjectRequest with only basic options.

Method Summary
`String` `getETag()` Gets the optional ETag that, when present, must be a match for the source object's current ETag in order for the copy object request to be executed.
`ObjectMetadata` `getNewObjectMetadata()` Gets the optional object metadata to set for the new, copied object.
`String` `getSourceBucketName()` Gets the name of the bucket containing the source object to be copied.
`String` `getSourceKey()` Gets the source bucket key under which the source object to be copied is stored.
`void` `setETag(String eTag)` Sets the optional ETag that, when present, must be a match for the source object's current ETag in order for the copy object request to be executed.
`void` `setNewObjectMetadata(ObjectMetadata newObjectMetadata)` Sets the object metadata to use for the new, copied object.
`void` `setSourceBucketName(String sourceBucketName)` Sets the name of the bucket containing the source object to be copied.
`void` `setSourceKey(String sourceKey)` Sets the source bucket key under which the source object to be copied is stored.
`CopyObjectRequest` `withBucketName(String bucketName)` Sets the name of the destination bucket which will contain the new, copied object and returns this object, enabling additional method calls to be chained together.
`CopyObjectRequest` `withETag(String eTag)` Sets the optional ETag that, when present, must be a match for the source object's current ETag in order for the copy object request to be executed.
`CopyObjectRequest` `withKey(String key)` Sets the destination bucket key under which the new, copied object will be stored and returns this object, enabling additional method calls can be chained together.
`CopyObjectRequest` `withNewObjectMetadata(ObjectMetadata newObjectMetadata)` Sets the object metadata to use for the new, copied object and returns this object, enabling additional method calls to be chained together.
`CopyObjectRequest` `withRequestCredentials(BceCredentials credentials)`
`CopyObjectRequest` `withSourceBucketName(String sourceBucketName)` Sets the name of the bucket containing the source object to be copied, and returns this object, enabling additional method calls to be chained together.
`CopyObjectRequest` `withSourceKey(String sourceKey)` Sets the key in the source bucket under which the source object to be copied is stored and returns this object, enabling additional method calls to be chained together.

Methods inherited from class com.baidubce.services.bos.model.GenericObjectRequest
`getKey, setKey`

Methods inherited from class com.baidubce.services.bos.model.GenericBucketRequest
`getBucketName, setBucketName`

Methods inherited from class com.baidubce.model.AbstractBceRequest
`getRequestCredentials, setRequestCredentials`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CopyObjectRequest

    public CopyObjectRequest(String sourceBucketName,
                             String sourceKey,
                             String bucketName,
                             String key)

  Constructs a new CopyObjectRequest with only basic options.

  Parameters:
    `sourceBucketName` - The name of the Bos bucket containing the object to copy.
    `sourceKey` - The source bucket key under which the object to copy is stored.
    `bucketName` - The name of the Bos bucket to which the new object will be copied.
    `key` - The destination bucket key under which the new object will be copied.

Method Detail

### getSourceBucketName

    public String getSourceBucketName()

  Gets the name of the bucket containing the source object to be copied.

  Returns:
    The name of the bucket containing the source object to be copied.

### setSourceBucketName

    public void setSourceBucketName(String sourceBucketName)

  Sets the name of the bucket containing the source object to be copied.

  Parameters:
    `sourceBucketName` - The name of the bucket containing the source object to be copied.

### withSourceBucketName

    public CopyObjectRequest withSourceBucketName(String sourceBucketName)

  Sets the name of the bucket containing the source object to be copied, and returns this object, enabling additional method calls to be chained together.

  Parameters:
    `sourceBucketName` - The name of the bucket containing the source object to be copied.
  Returns:
    This `CopyObjectRequest` instance, enabling additional method calls to be chained together.

### getSourceKey

    public String getSourceKey()

  Gets the source bucket key under which the source object to be copied is stored.

  Returns:
    The source bucket key under which the source object to be copied is stored.

### setSourceKey

    public void setSourceKey(String sourceKey)

  Sets the source bucket key under which the source object to be copied is stored.

  Parameters:
    `sourceKey` - The source bucket key under which the source object to be copied is stored.

### withSourceKey

    public CopyObjectRequest withSourceKey(String sourceKey)

  Sets the key in the source bucket under which the source object to be copied is stored and returns this object, enabling additional method calls to be chained together.

  Parameters:
    `sourceKey` - The key in the source bucket under which the source object to be copied is stored.
  Returns:
    This `CopyObjectRequest` instance, enabling additional method calls to be chained together.

### withRequestCredentials

    public CopyObjectRequest withRequestCredentials(BceCredentials credentials)

  Specified by:
    `withRequestCredentials` in class `AbstractBceRequest`

### withBucketName

    public CopyObjectRequest withBucketName(String bucketName)

  Sets the name of the destination bucket which will contain the new, copied object and returns this object, enabling additional method calls to be chained together.

  Specified by:
    `withBucketName` in class `GenericBucketRequest`
  Parameters:
    `bucketName` - The name of the destination bucket which will contain the new, copied object.
  Returns:
    This `CopyObjectRequest`, enabling additional method calls to be chained together.

### withKey

    public CopyObjectRequest withKey(String key)

  Sets the destination bucket key under which the new, copied object will be stored and returns this object, enabling additional method calls can be chained together.

  Specified by:
    `withKey` in class `GenericObjectRequest`
  Parameters:
    `key` - The destination bucket key under which the new, copied object will be stored.
  Returns:
    This `CopyObjectRequest`, enabling additional method calls to be chained together.

### getNewObjectMetadata

    public ObjectMetadata getNewObjectMetadata()

  Gets the optional object metadata to set for the new, copied object.

  Returns:
    The object metadata to set for the newly copied object. Returns `null` if no object metadata has been specified.

### setNewObjectMetadata

    public void setNewObjectMetadata(ObjectMetadata newObjectMetadata)

  Sets the object metadata to use for the new, copied object. By default the object metadata from the source object is copied to the destination object, but when setting object metadata with this method, no metadata from the source object is copied. Instead, the new destination object will have the metadata specified with this call.

  Parameters:
    `newObjectMetadata` - The object metadata to use for the newly copied object.

### withNewObjectMetadata

    public CopyObjectRequest withNewObjectMetadata(ObjectMetadata newObjectMetadata)

  Sets the object metadata to use for the new, copied object and returns this object, enabling additional method calls to be chained together. By default, the object metadata from the source object will be copied to the destination object, but if callers set object metadata with this method, it will be used instead.

  Parameters:
    `newObjectMetadata` - The object metadata to use for the newly copied object.
  Returns:
    This `CopyObjectRequest`, enabling additional method calls to be chained together.

### getETag

    public String getETag()

  Gets the optional ETag that, when present, must be a match for the source object's current ETag in order for the copy object request to be executed.

  Returns:
    The optional ETag that when present must be a match for the source object's current ETag in order for this request to be executed.

### setETag

    public void setETag(String eTag)

  Sets the optional ETag that, when present, must be a match for the source object's current ETag in order for the copy object request to be executed.

  Parameters:
    `eTag` - The optional ETag that when present must be a match for the source object's current ETag in order for this request to be executed.

### withETag

    public CopyObjectRequest withETag(String eTag)

  Sets the optional ETag that, when present, must be a match for the source object's current ETag in order for the copy object request to be executed.

  Parameters:
    `eTag` - The optional ETag that when present must be a match for the source object's current ETag in order for this request to be executed.
  Returns:
    This `CopyObjectRequest`, enabling additional method calls to be chained together.

Copyright © 2016. All rights reserved.