
com.microsoft.windowsazure.storage.table.TableRequestOptions Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of microsoft-windowsazure-storage-sdk Show documentation
Show all versions of microsoft-windowsazure-storage-sdk Show documentation
SDK for Microsoft Azure Storage Clients
/**
* Copyright Microsoft Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.microsoft.windowsazure.storage.table;
import com.microsoft.windowsazure.storage.RequestOptions;
import com.microsoft.windowsazure.storage.core.Utility;
/**
* Represents a set of timeout, payload format, and retry policy options that may be specified for a table operation
* request.
*/
public class TableRequestOptions extends RequestOptions {
/**
* The interface whose function is used to get the for an entity property
* given the partition key, row, key, and the property name, if the interface is implemented
*/
public interface PropertyResolver {
/**
* Given the partition key, row, key, and the property name, produces the EdmType
*
* @param pk
* The partition key
* @param rk
* The row key
* @param key
* The property name
* @param value
* The property value
* @return
* EdmType of the property
*/
public EdmType propertyResolver(String pk, String rk, String key, String value);
}
/**
* The interface whose function is used to get the for an entity property
* given the partition key, row, key, and the property name, if the interface is implemented
*/
private PropertyResolver propertyResolver;
/**
* The TableRequestOptions
*/
public TableRequestOptions() {
super();
}
/**
* Creates an instance of the RequestOptions
class by copying values from another
* TableRequestOptions
instance.
*
* @param other
* A TableRequestOptions
object that represents the request options to copy.
*/
public TableRequestOptions(final TableRequestOptions other) {
super(other);
if (other != null) {
this.setTablePayloadFormat(other.getTablePayloadFormat());
this.setPropertyResolver(other.getPropertyResolver());
}
}
/**
* Reserved for internal use. Initializes the values for this TableRequestOptions
instance, if they are
* currently null
, using the values specified in the {@link CloudTableClient} parameter.
*
* @param options
* The input options to copy from when applying defaults
* @param client
* The {@link CloudTableClient} client object to copy the timeout and retry policy from.
*/
protected static final TableRequestOptions applyDefaults(final TableRequestOptions options,
final CloudTableClient client) {
TableRequestOptions modifiedOptions = new TableRequestOptions(options);
return TableRequestOptions.applyDefaultsInternal(modifiedOptions, client);
}
protected static final TableRequestOptions applyDefaultsInternal(TableRequestOptions modifiedOptions,
CloudTableClient client) {
Utility.assertNotNull("modifiedOptions", modifiedOptions);
RequestOptions.applyBaseDefaultsInternal(modifiedOptions, client);
if (modifiedOptions.getTablePayloadFormat() == null) {
modifiedOptions.setTablePayloadFormat(client.getTablePayloadFormat());
}
return modifiedOptions;
}
/**
* Gets the for an entity property
* given the partition key, row, key, and the property name.
*
* @return
* The property resolver in use
*/
public PropertyResolver getPropertyResolver() {
return this.propertyResolver;
}
/**
* Sets the for an entity property
* given the partition key, row, key, and the property name.
*
* @param propertyResolver
* The property resolver to use.
*/
public void setPropertyResolver(PropertyResolver propertyResolver) {
this.propertyResolver = propertyResolver;
}
}