net.degreedays.api.data
Class DataSpecs.CustomKeyBuilder

java.lang.Object
  extended by net.degreedays.api.data.DataSpecs.CustomKeyBuilder
Enclosing class:
DataSpecs

public static final class DataSpecs.CustomKeyBuilder
extends java.lang.Object

For advanced use, this provides a way to create a DataSpecs object with custom keys. To use:

Instances of this builder class are designed for single-threaded use only. It's fine to create and use instances in multiple concurrent threads, but, in the absence of external synchronization, the use of each individual builder instance should be restricted to one thread only.


Constructor Summary
DataSpecs.CustomKeyBuilder()
          Constructs an empty DataSpecs.CustomKeyBuilder.
 
Method Summary
 DataSpecs.CustomKeyBuilder add(java.lang.String key, DataSpec dataSpec)
          Adds a unique key and the DataSpec to be associated with it.
 DataSpecs build()
          Creates a DataSpecs object with the configuration that is currently held by this builder.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataSpecs.CustomKeyBuilder

public DataSpecs.CustomKeyBuilder()
Constructs an empty DataSpecs.CustomKeyBuilder.

Method Detail

add

public DataSpecs.CustomKeyBuilder add(java.lang.String key,
                                      DataSpec dataSpec)
Adds a unique key and the DataSpec to be associated with it.

Parameters:
key - a string to be used as the key for dataSpec in the XML request and response. Cannot be null, cannot be empty, cannot have more than 60 characters, and cannot contain characters outside of [-_.a-zA-Z0-9]. (Note that we might expand this set of allowed characters at some point. Please let us know if you'd like us to.)
dataSpec - the non-null DataSpec to be added and associated with key.
Returns:
this, for method chaining.
Throws:
java.lang.NullPointerException - if key or dataSpec is null.
java.lang.IllegalArgumentException - if key does not match the required specification, or if a DataSpec has already been added with key.

build

public DataSpecs build()
Creates a DataSpecs object with the configuration that is currently held by this builder.

Throws:
java.lang.IllegalStateException - if you have not added at least one key-DataSpec pair, or if you have added more than 100.


www.degreedays.net/api/