ParameterList
open class ParameterList : ListBase, Sequence
A list of item type Parameter
.
-
Undocumented
Declaration
Swift
public subscript(index: Int) -> Parameter { get set }
-
An immutable empty
ParameterList
.Declaration
Swift
public static let empty: ParameterList
-
Construct a new list with
length
of zero and optional initialcapacity
. A list can expand in length beyond its initial capacity, but best performance will be obtained if the initial capacity is close to (and not less than) the list’s maximum length.Declaration
Swift
override public init(capacity: Int = (4 as Int))
Parameters
capacity
Optional initial capacity.
-
Add a formal parameter.
See also
with
.Declaration
Swift
open func addFormal(name: String, type: DataType)
Parameters
name
Parameter name.
type
Parameter type.
-
Add
item
to the end of this list.Declaration
Swift
public final func append(_ item: Parameter)
Parameters
item
Item to be added.
-
Add all the items of
list
to the end of this list.Declaration
Swift
public final func append(contentsOf list: ParameterList)
Parameters
list
Items to be added.
-
Declaration
Swift
public final func copy() -> ParameterList
Return Value
A shallow copy of this list.
-
Declaration
Swift
override open func copyMutable() -> DataValue
Return Value
a copy of this list which doesn’t share any mutable values with this list. The resulting list will not share any mutable values with this list. The resulting list might share immutable values with this list.
-
Declaration
Swift
public final func filter(_ predicate: @escaping (Parameter) -> Bool) -> ParameterList
Parameters
predicate
Function to be applied to each item of this list. Items matching this predicate will be returned in the new list.
Return Value
A new list which contains the items of this list that match a specified predicate function. Ordering is preserved.
-
Throws
EmptyListException
if the list is empty.Declaration
Swift
public final func first() -> Parameter
Return Value
The first item in this list.
-
Convert array to list.
Declaration
Swift
open class func fromArray(_ array: Array<Parameter>) -> ParameterList
Parameters
array
Array with source items.
Return Value
New list with items copied from
array
parameter. -
Declaration
Swift
public final func indexOf(item: Parameter, start: Int = (0 as Int)) -> Int
Parameters
item
Item for comparison. Comparison uses the
equality
property, which would usually be expected to match the==
operator for item typeParameter
.start
Zero-based starting index (search moves forwards from this index).
Return Value
First index in this list of
item
, or-1
if not found. -
Insert
item
into this list, before the item (if any) atindex
.Throws
ListIndexException
ifindex
is out of range (0 tolength
).Declaration
Swift
public final func insert(at index: Int, item: Parameter)
Parameters
index
Zero-based index.
item
Item to be added.
-
Insert all items of
list
into this list, before the item (if any) atindex
.Throws
ListIndexException
ifindex
is out of range (0 tolength
).Declaration
Swift
public final func insert(at index: Int, contentsOf list: ParameterList)
Parameters
index
Zero-based index.
list
List of items to be inserted.
-
Throws
ListIndexException
ifindex
is out of range (0 tolength
- 1).Declaration
Swift
public final func item(at index: Int) -> Parameter
Parameters
index
Zero-based index.
Return Value
The item in this list at the specified
index
. -
Throws
EmptyListException
if the list is empty.Declaration
Swift
public final func last() -> Parameter
Return Value
The last item in this list.
-
Declaration
Swift
public final func lastIndexOf(item: Parameter, start: Int = (2147483647 as Int)) -> Int
Parameters
item
Item for comparison. Comparison uses the
equality
property, which would usually be expected to match the==
operator for item typeParameter
.start
Zero-based starting index (search moves backwards from this index).
Return Value
Last index in this list of
item
, or-1
if not found. -
Declaration
Swift
open func makeIterator() -> IndexingIterator<Array<Parameter>>
Return Value
This list converted to a Swift iterator.
-
Removed the parameter with the specified
name
.Declaration
Swift
open func remove(name: String) -> Bool
Parameters
name
Name of parameter to be removed.
Return Value
true
if a parameter with the specified name was found (and removed), otherwise false. -
Declaration
Swift
open func required(name: String) -> DataValue?
Parameters
name
Required parameter name.
Return Value
the value of a required parameter, or throw
DataServiceException
with status 400 (Client Error) if the parameter is missing. -
Declaration
Swift
open func requiredList(name: String) -> ListBase
Parameters
name
Required parameter name.
Return Value
the value of a required parameter with list type, or throw
DataServiceException
with status 400 (Client Error) if the parameter is missing. -
See also
copy
,reverse
.Declaration
Swift
open func reversed() -> ParameterList
Return Value
a reversed copy of this list.
-
Return a new
ParameterList
that shares theListBase.untypedList
as thelist
parameter. To ensure type safety, items inlist
that do not have the item typeParameter
will be removed.Declaration
Swift
open class func share(_ list: ListBase) -> ParameterList
Parameters
list
List whose items will be shared by the resulting list.
Return Value
A new list of item type
Parameter
, sharing the same items aslist
. -
Throws
EmptyListException
if the list has no items,NotUniqueException
if the list has multiple items.Declaration
Swift
public final func single() -> Parameter
Return Value
A single item from this list.
-
Declaration
Swift
public final func slice(start: Int, end: Int = (2147483647 as Int)) -> ParameterList
Parameters
start
Zero-based starting index (inclusive), or negative for starting index relative to the end of this list.
end
Zero-based ending index (exclusive), or negative for ending index relative to the end of this list.
Return Value
A slice of this list from index
start
(inclusive) to indexend
(exclusive). -
Sort this list in place (stable sort, O(n log n) complexity).
See also
copy
,sort
.Parameters
increasing
Predicate that returns
true
if its first argument should preceed its second argument in the desired ordering. -
See also
copy
,sort
.Declaration
Swift
public final func sorted() -> ParameterList
Return Value
a sorted copy of this list using this list’s default
comparer
for ordering (stable sort, O(n log n) complexity). -
See also
copy
,sortBy
.Declaration
Parameters
increasing
Predicate that returns
true
if its first argument should preceed its second argument in the desired ordering.Return Value
a sorted copy of this list (stable sort, O(n log n) complexity).
-
Declaration
Swift
open func toArray() -> Array<Parameter>
Return Value
This list converted to a Swift array.
-
Declaration
Swift
open func toNameList() -> StringList
Return Value
A list with the
Parameter.name
for each parameter in this list. -
Set the item in this list at the specified
index
.Declaration
Swift
public final func update(at index: Int, item: Parameter)
Parameters
index
Zero-based index.
item
Item value.
-
See also
add
.Declaration
Swift
open func with(name: String, value: DataValue?) -> ParameterList
Parameters
name
Parameter name.
value
Parameter value.
Return Value
This list after adding an actual parameter.