C# Client Library
A C# Client Library for the AnalyzeRe REST API
AnalyzeRe.Reference< T > Class Template Reference

Implements the reference entity interface, with support for resolving references using lazy loading. More...

Public Member Functions

 Reference (string ref_id)
 Creates a new instance of this reference type that refers to an object with the specified id. More...
 
 Reference (string ref_id, string href)
 Creates a new reference that refers to an object of the current type, with the specified id but with a specific href (URL) which may be different . More...
 
 Reference (IReference other)
 Creates a new reference class that refers to the same object referred to by the other reference class. More...
 
 Reference (T value)
 Creates a new reference to the specified resource. More...
 
override bool Equals (object obj)
 Determines whether the two reference objects refer to the same object. More...
 
override int GetHashCode ()
 Serves as a hash function for reference objects. More...
 
GetValue (IEnumerable< Parameter > requestParameters=null, int?timeout=null, bool updateCache=false)
 Gets the resource that this reference refers to. If the reference has not previously been resolved, this is done by requesting it from the server, otherwise the previously resolved instance is returned (unless updateCache is set to true). More...
 
void Resolve (IEnumerable< Parameter > requestParameters=null, int?timeout=null, bool updateCache=false)
 Resolve this reference by retrieving the referenced object. If this reference is already resolved, this method does nothing. To refresh the resolved object (e.g. if the referenced object is mutable and might have changed) you can set updateCache to true. More...
 
override string ToString ()
 Returns this reference's id, or value type if it has no id. More...
 

Static Public Member Functions

static string GuessHref (string ref_id, T value=default(T))
 Attempts to guess the URL at which this resource can be resolved based on the resource collection name specified by the type T. More...
 
static implicit operator Reference< T > (T value)
 Allows an IAPIResource object to be implicitly converted to a new Reference to that object. More...
 
static implicit operator T (Reference< T > value)
 Allows a reference instance to be implicitly converted to an instance of the IAPIResource object it's referencing. More...
 

Public Attributes

string CollectionName => _localCollectionName ?? TypeCollectionName
 The name of the collection at which this resource resides. More...
 

Properties

bool resolved [get]
 Indicates whether this reference has been resolved into an object. More...
 
Value [get]
 Returns the object this reference refers to by resolving it with a request to the server. More...
 

Detailed Description

Implements the reference entity interface, with support for resolving references using lazy loading.

Type Constraints
T :IAPIResource 

Definition at line 19 of file Reference[T].cs.

Inheritance diagram for AnalyzeRe.Reference< T >:
AnalyzeRe.IReference< T >

Constructor & Destructor Documentation

AnalyzeRe.Reference< T >.Reference ( string  ref_id)
inline

Creates a new instance of this reference type that refers to an object with the specified id.

Parameters
ref_idThe id of the object being referred to.

Definition at line 81 of file Reference[T].cs.

AnalyzeRe.Reference< T >.Reference ( string  ref_id,
string  href 
)
inline

Creates a new reference that refers to an object of the current type, with the specified id but with a specific href (URL) which may be different .

Parameters
ref_idThe id of the object being referred to.
hrefThe HREF of the object being referred to.

Definition at line 87 of file Reference[T].cs.

AnalyzeRe.Reference< T >.Reference ( IReference< T >  other)
inline

Creates a new reference class that refers to the same object referred to by the other reference class.

Parameters
otherThe reference class to copy reference information from.

Definition at line 107 of file Reference[T].cs.

AnalyzeRe.Reference< T >.Reference ( value)
inline

Creates a new reference to the specified resource.

Parameters
valueThe resource to create a reference to.

Definition at line 116 of file Reference[T].cs.

Member Function Documentation

override bool AnalyzeRe.Reference< T >.Equals ( object  obj)
inline

Determines whether the two reference objects refer to the same object.

Parameters
objThe reference object to compare to this one.
Returns
True if the two reference objects are equivalent.

Definition at line 269 of file Reference[T].cs.

override int AnalyzeRe.Reference< T >.GetHashCode ( )
inline

Serves as a hash function for reference objects.

Returns
A hash code for the current Reference.

Definition at line 284 of file Reference[T].cs.

T AnalyzeRe.Reference< T >.GetValue ( IEnumerable< Parameter >  requestParameters = null,
int?  timeout = null,
bool  updateCache = false 
)
inline

Gets the resource that this reference refers to. If the reference has not previously been resolved, this is done by requesting it from the server, otherwise the previously resolved instance is returned (unless updateCache is set to true).

Parameters
requestParametersOptional - Additional parameters to include in the GET request resolving the resource, only used if the resource is not already resolved, or if updateCache is set to true.
timeoutOptional (Default: no timeout) - The desired request timeout (in milliseconds) after which the request will time out.
updateCacheOptional (Default: false) - Set to true to ignore the previously resolved reference value (if any) and retrieve an updated copy of the resource from the server. If false, and this reference was previously resolved, a reference to the previously resolved resource will be returned.
Exceptions
TimeoutExceptionIf the server takes longer than timeout milliseconds to return the resource.
Returns
The resource that this reference refers to.

Definition at line 170 of file Reference[T].cs.

static string AnalyzeRe.Reference< T >.GuessHref ( string  ref_id,
value = default(T) 
)
inlinestatic

Attempts to guess the URL at which this resource can be resolved based on the resource collection name specified by the type T.

Returns
The guessed URL at which this resource can be resolved.

Definition at line 140 of file Reference[T].cs.

static implicit AnalyzeRe.Reference< T >.operator Reference< T > ( value)
inlinestatic

Allows an IAPIResource object to be implicitly converted to a new Reference to that object.

Definition at line 261 of file Reference[T].cs.

static implicit AnalyzeRe.Reference< T >.operator T ( Reference< T >  value)
inlinestatic

Allows a reference instance to be implicitly converted to an instance of the IAPIResource object it's referencing.

Definition at line 254 of file Reference[T].cs.

void AnalyzeRe.Reference< T >.Resolve ( IEnumerable< Parameter >  requestParameters = null,
int?  timeout = null,
bool  updateCache = false 
)
inline

Resolve this reference by retrieving the referenced object. If this reference is already resolved, this method does nothing. To refresh the resolved object (e.g. if the referenced object is mutable and might have changed) you can set updateCache to true.

Parameters
requestParametersOptional - Additional parameters to include in the GET request resolving the resource, only used if the resource is not already resolved.
timeoutOptional (Default: no timeout) - The desired request timeout (in milliseconds) after which the request will time out.
updateCacheOptional (Default: false) - Set to true to ignore any previously resolved reference value (if any) and re-retrieve an updated copy of the resource from the server. If false, and this reference was previously resolved, a reference to the previously resolved resource will be returned.
Exceptions
TimeoutExceptionIf the server takes longer than timeout milliseconds to return the resource.

Definition at line 192 of file Reference[T].cs.

override string AnalyzeRe.Reference< T >.ToString ( )
inline

Returns this reference's id, or value type if it has no id.

Returns
The content of the ref_id property.

Definition at line 301 of file Reference[T].cs.

Member Data Documentation

string AnalyzeRe.Reference< T >.CollectionName => _localCollectionName ?? TypeCollectionName

The name of the collection at which this resource resides.

Definition at line 40 of file Reference[T].cs.

Property Documentation

bool AnalyzeRe.Reference< T >.resolved
get

Indicates whether this reference has been resolved into an object.

Definition at line 44 of file Reference[T].cs.

T AnalyzeRe.Reference< T >.Value
get

Returns the object this reference refers to by resolving it with a request to the server.

Definition at line 53 of file Reference[T].cs.


The documentation for this class was generated from the following file: