Browse Source

Add `Collection` methods for ArrayList/HashTable

pull/8/head
Anton Tarasenko 2 years ago
parent
commit
10daee4220
  1. 73
      sources/Data/Collections/Collection.uc

73
sources/Data/Collections/Collection.uc

@ -388,6 +388,43 @@ public final function DynamicArray GetDynamicArrayBy(BaseText jsonPointerAsText)
return DynamicArray(GetItemBy(jsonPointerAsText)); return DynamicArray(GetItemBy(jsonPointerAsText));
} }
/**
* Returns an `HashTable` value stored (in the caller `Collection` or
* one of it's sub-collections) pointed by
* [JSON pointer](https://tools.ietf.org/html/rfc6901).
* See `GetItemBy()` for more information.
*
* Referred value must be stored as `HashTable`
* (or one of it's sub-classes) for this method to work.
*
* @param jsonPointerAsText Description of a path to the `HashTable` value.
* @return `HashTable` value, stored at `jsonPointerAsText` or
* `none` if it is missing or has a different type.
*/
public final function HashTable GetHashTableBy(
BaseText jsonPointerAsText)
{
return HashTable(GetItemBy(jsonPointerAsText));
}
/**
* Returns an `ArrayList` value stored (in the caller `Collection` or
* one of it's sub-collections) pointed by
* [JSON pointer](https://tools.ietf.org/html/rfc6901).
* See `GetItemBy()` for more information.
*
* Referred value must be stored as `ArrayList`
* (or one of it's sub-classes) for this method to work.
*
* @param jsonPointerAsText Description of a path to the `ArrayList` value.
* @return `ArrayList` value, stored at `jsonPointerAsText` or
* `none` if it is missing or has a different type.
*/
public final function ArrayList GetArrayListBy(BaseText jsonPointerAsText)
{
return ArrayList(GetItemBy(jsonPointerAsText));
}
/** /**
* Returns a `bool` value stored (in the caller `Collection` or * Returns a `bool` value stored (in the caller `Collection` or
* one of it's sub-collections) pointed by JSON pointer. * one of it's sub-collections) pointed by JSON pointer.
@ -589,6 +626,42 @@ public final function DynamicArray GetDynamicArrayByJSON(
return DynamicArray(GetItemByJSON(jsonPointer)); return DynamicArray(GetItemByJSON(jsonPointer));
} }
/**
* Returns an `HashTable` value stored (in the caller `Collection` or
* one of it's sub-collections) pointed by JSON pointer.
* See `GetItemByJSON()` for more information.
*
* Referred value must be stored as `HashTable`
* (or one of it's sub-classes) for this method to work.
*
* @param jsonPointer JSON path to the `HashTable` value.
* @return `HashTable` value, stored at `jsonPointerAsText` or
* `none` if it is missing or has a different type.
*/
public final function HashTable GetHashTableByJSON(
JSONPointer jsonPointer)
{
return HashTable(GetItemByJSON(jsonPointer));
}
/**
* Returns an `ArrayList` value stored (in the caller `Collection` or
* one of it's sub-collections) pointed by JSON pointer.
* See `GetItemByJSON()` for more information.
*
* Referred value must be stored as `ArrayList`
* (or one of it's sub-classes) for this method to work.
*
* @param jsonPointer JSON path to the `ArrayList` value.
* @return `ArrayList` value, stored at `jsonPointerAsText` or
* `none` if it is missing or has a different type.
*/
public final function ArrayList GetArrayListByJSON(
JSONPointer jsonPointer)
{
return ArrayList(GetItemByJSON(jsonPointer));
}
defaultproperties defaultproperties
{ {
} }
Loading…
Cancel
Save