Skip to content

Commit

Permalink
Document EvaluationContext members.
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
  • Loading branch information
kinyoklion committed Sep 13, 2022
1 parent 2768d4c commit 5771f01
Showing 1 changed file with 97 additions and 34 deletions.
131 changes: 97 additions & 34 deletions src/OpenFeature.SDK/Model/EvaluationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,50 @@ public class EvaluationContext
/// <summary>
/// Gets the Value at the specified key
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
/// <param name="key">The key of the value to be retrieved</param>
/// <returns>The <see cref="Value"/> associated with the key.</returns>
/// <exception cref="KeyNotFoundException">
/// Thrown when the context does not contain the specified key.
/// </exception>
/// <exception cref="ArgumentNullException">
/// Thrown when the key is <see langword="null" />.
/// </exception>
public Value GetValue(string key) => this._structure.GetValue(key);

/// <summary>
/// Bool indicating if the specified key exists in the evaluation context
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
/// <param name="key">The key of the value to be checked</param>
/// <returns><see cref="bool" />indicating the presence of the key.</returns>
/// <exception cref="ArgumentNullException">
/// Thrown when the key is <see langword="null" />.
/// </exception>
public bool ContainsKey(string key) => this._structure.ContainsKey(key);

/// <summary>
/// Removes the Value at the specified key
/// </summary>
/// <param name="key"></param>
/// <param name="key">The key of the value to be removed</param>
/// <exception cref="ArgumentNullException">
/// Thrown when the key is <see langword="null" />.
/// </exception>
public void Remove(string key) => this._structure.Remove(key);

/// <summary>
/// Gets the value associated with the specified key
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns></returns>
/// <param name="value">The <see cref="Value"/> or <see langword="null" /> if the key was not present.</param>
/// <param name="key">The key of the value to be retrieved</param>
/// <returns><see cref="bool" />indicating the presence of the key.</returns>
/// <exception cref="ArgumentNullException">
/// Thrown when the key is <see langword="null" />.
/// </exception>
public bool TryGetValue(string key, out Value value) => this._structure.TryGetValue(key, out value);

/// <summary>
/// Gets all values as a Dictionary
/// </summary>
/// <returns></returns>
/// <returns>New <see cref="IDictionary{TKey,TValue}"/> representation of this Structure</returns>
public IDictionary<string, Value> AsDictionary()
{
return new Dictionary<string, Value>(this._structure.AsDictionary());
Expand All @@ -52,9 +67,15 @@ public IDictionary<string, Value> AsDictionary()
/// <summary>
/// Add a new bool Value to the evaluation context
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns></returns>
/// <param name="key">The key of the value to be added</param>
/// <param name="value">The value to be added</param>
/// <returns>This <see cref="EvaluationContext"/></returns>
/// <exception cref="ArgumentNullException">
/// Thrown when the key is <see langword="null" />.
/// </exception>
/// <exception cref="ArgumentException">
/// Thrown when an element with the same key is already contained in the context.
/// </exception>
public EvaluationContext Add(string key, bool value)
{
this._structure.Add(key, value);
Expand All @@ -64,9 +85,15 @@ public EvaluationContext Add(string key, bool value)
/// <summary>
/// Add a new string Value to the evaluation context
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns></returns>
/// <param name="key">The key of the value to be added</param>
/// <param name="value">The value to be added</param>
/// <returns>This <see cref="EvaluationContext"/></returns>
/// <exception cref="ArgumentNullException">
/// Thrown when the key is <see langword="null" />.
/// </exception>
/// <exception cref="ArgumentException">
/// Thrown when an element with the same key is already contained in the context.
/// </exception>
public EvaluationContext Add(string key, string value)
{
this._structure.Add(key, value);
Expand All @@ -76,9 +103,15 @@ public EvaluationContext Add(string key, string value)
/// <summary>
/// Add a new int Value to the evaluation context
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns></returns>
/// <param name="key">The key of the value to be added</param>
/// <param name="value">The value to be added</param>
/// <returns>This <see cref="EvaluationContext"/></returns>
/// <exception cref="ArgumentNullException">
/// Thrown when the key is <see langword="null" />.
/// </exception>
/// <exception cref="ArgumentException">
/// Thrown when an element with the same key is already contained in the context.
/// </exception>
public EvaluationContext Add(string key, int value)
{
this._structure.Add(key, value);
Expand All @@ -88,9 +121,15 @@ public EvaluationContext Add(string key, int value)
/// <summary>
/// Add a new double Value to the evaluation context
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns></returns>
/// <param name="key">The key of the value to be added</param>
/// <param name="value">The value to be added</param>
/// <returns>This <see cref="EvaluationContext"/></returns>
/// <exception cref="ArgumentNullException">
/// Thrown when the key is <see langword="null" />.
/// </exception>
/// <exception cref="ArgumentException">
/// Thrown when an element with the same key is already contained in the context.
/// </exception>
public EvaluationContext Add(string key, double value)
{
this._structure.Add(key, value);
Expand All @@ -100,9 +139,15 @@ public EvaluationContext Add(string key, double value)
/// <summary>
/// Add a new DateTime Value to the evaluation context
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns></returns>
/// <param name="key">The key of the value to be added</param>
/// <param name="value">The value to be added</param>
/// <returns>This <see cref="EvaluationContext"/></returns>
/// <exception cref="ArgumentNullException">
/// Thrown when the key is <see langword="null" />.
/// </exception>
/// <exception cref="ArgumentException">
/// Thrown when an element with the same key is already contained in the context.
/// </exception>
public EvaluationContext Add(string key, DateTime value)
{
this._structure.Add(key, value);
Expand All @@ -112,9 +157,15 @@ public EvaluationContext Add(string key, DateTime value)
/// <summary>
/// Add a new Structure Value to the evaluation context
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns></returns>
/// <param name="key">The key of the value to be added</param>
/// <param name="value">The value to be added</param>
/// <returns>This <see cref="EvaluationContext"/></returns>
/// <exception cref="ArgumentNullException">
/// Thrown when the key is <see langword="null" />.
/// </exception>
/// <exception cref="ArgumentException">
/// Thrown when an element with the same key is already contained in the context.
/// </exception>
public EvaluationContext Add(string key, Structure value)
{
this._structure.Add(key, value);
Expand All @@ -124,9 +175,15 @@ public EvaluationContext Add(string key, Structure value)
/// <summary>
/// Add a new List Value to the evaluation context
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns></returns>
/// <param name="key">The key of the value to be added</param>
/// <param name="value">The value to be added</param>
/// <returns>This <see cref="EvaluationContext"/></returns>
/// <exception cref="ArgumentNullException">
/// Thrown when the key is <see langword="null" />.
/// </exception>
/// <exception cref="ArgumentException">
/// Thrown when an element with the same key is already contained in the context.
/// </exception>
public EvaluationContext Add(string key, List<Value> value)
{
this._structure.Add(key, value);
Expand All @@ -136,9 +193,15 @@ public EvaluationContext Add(string key, List<Value> value)
/// <summary>
/// Add a new Value to the evaluation context
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns></returns>
/// <param name="key">The key of the value to be added</param>
/// <param name="value">The value to be added</param>
/// <returns>This <see cref="EvaluationContext"/></returns>
/// <exception cref="ArgumentNullException">
/// Thrown when the key is <see langword="null" />.
/// </exception>
/// <exception cref="ArgumentException">
/// Thrown when an element with the same key is already contained in the context.
/// </exception>
public EvaluationContext Add(string key, Value value)
{
this._structure.Add(key, value);
Expand Down Expand Up @@ -173,7 +236,7 @@ public void Merge(EvaluationContext other)
/// <summary>
/// Return an enumerator for all values
/// </summary>
/// <returns></returns>
/// <returns>An enumerator for all values</returns>
public IEnumerator<KeyValuePair<string, Value>> GetEnumerator()
{
return this._structure.GetEnumerator();
Expand Down

0 comments on commit 5771f01

Please sign in to comment.