StructureBase

open class StructureBase: DataValue, Codable

The canonical path of this value relative to the service root URL. Common base class for ComplexValue and EntityValue.

  • Decode and initialize a new object instance

    Declaration

    Swift

    public required init(from decoder: Decoder) throws

    Parameters

    from

    decoder object which contains the original object’s serialized data in a container instance

  • Abstract function to encode the object instance

    Declaration

    Swift

    public func encode(to encoder: Encoder) throws

    Parameters

    to

    encoder object which can be used to serialize the object’s data one by one into a container instance

  • Default initializer.

    Declaration

    Swift

    override public init()
  • Get the value of a specified property.

    Throws

    UndefinedException if the property value was not previously set.

    See also

    hasDataValue.

    Declaration

    Swift

    open func dataValue(for property: Property) -> DataValue?

    Parameters

    property

    The specified property.

    Return Value

    The property value, as an instance of the appropriate subclass of DataValue, or nil if the property value is nil.

  • Holds dynamic property values, for which metadata is not known in advance.

    See also

    ComplexType.isOpenType, EntityType.isOpenType.

    Declaration

    Swift

    open var dynamicProperties: DataValueMap
  • See also

    dynamicProperties.

    Declaration

    Swift

    open func dynamicValue(name: String) -> DataValue?

    Parameters

    name

    Name of a dynamic property.

    Return Value

    The value of a dynamic property, or nil if no such property exists.

  • Declaration

    Swift

    open func hasDataType(_ type: DataType) -> Bool

    Parameters

    type

    Specified data type.

    Return Value

    true if this structure has the specified data type (or a subtype).

  • Declaration

    Swift

    open func hasDataValue(for property: Property) -> Bool

    Parameters

    property

    The specified property.

    Return Value

    true if this structure contains an explicitly set value for the specified property (including nil, if Property.isNullable).

  • Is this structure an instance of a generated proxy class?

    Declaration

    Swift

    open var isProxy: Bool
  • Get the optional value of a specified property.

    Declaration

    Swift

    open func optionalValue(for property: Property) -> DataValue?

    Parameters

    property

    The specified property.

    Return Value

    The property value, as an instance of the appropriate subclass of DataValue, or nil if the property value is nil or if the property value was not previously set.

  • Get the required value of a specified property.

    Throws

    UndefinedException if the property value was not previously set, CastException if the property value is nil.

    Declaration

    Swift

    open func requiredValue(for property: Property) -> DataValue

    Parameters

    property

    The specified property.

    Return Value

    The property value, using the appropriate subclass of DataValue.

  • Set the value of a specified property.

    Throws

    CastException if the property value does not have the expected type.

    Declaration

    Swift

    open func setDataValue(for property: Property, to value: DataValue?) -> Void

    Parameters

    property

    The specified property.

    value

    The property value (or nil), using the appropriate subclass of DataValue.

  • Recursively apply default values to any unset properties of this structure. If the property doesn’t have a model-defined default value, then nil will be used for nullable properties, and false/empty/zero values will be applied otherwise as appropriate. Dates will default to 2000-01-01.

    Declaration

    Swift

    open func setDefaultValues(nestedComplex: Bool = true, nestedEntity: Bool = false, overwrite: Bool = false) -> Void

    Parameters

    nestedComplex

    Apply recursively to complex-typed (structural) properties of this structure? Defaults to true.

    nestedEntity

    Apply recursively to entity-typed (navigation) properties of this structure? Defaults to false.

    overwrite

    Overwrite the property value even if it is already set.

  • Add or change the value of a dynamic property.

    See also

    dynamicProperties.

    Declaration

    Swift

    open func setDynamicValue(name: String, value: DataValue?) -> Void

    Parameters

    name

    Name of a dynamic property.

    value

    Value for the dynamic property.

  • Set the optional value of a specified property. If a nil value is provided and the property does not permit nil values (Property.isNullable is false), then this is equivalent to calling unsetDataValue, otherwise it is equivalent to calling setDataValue.

    Throws

    CastException if the property value does not have the expected type.

    Declaration

    Swift

    open func setOptionalValue(for property: Property, to value: DataValue?) -> Void

    Parameters

    property

    The specified property.

    value

    The property value (or nil), using the appropriate subclass of DataValue.

  • Set the required value of a specified property.

    Throws

    CastException if the property value does not have the expected type.

    Declaration

    Swift

    open func setRequiredValue(for property: Property, to value: DataValue) -> Void

    Parameters

    property

    The specified property.

    value

    The property value, using the appropriate subclass of DataValue.

  • Get the stream link for a specified stream property.

    Throws

    UsageException if the property is not a stream property.

    Declaration

    Swift

    open func streamLink(for property: Property) -> StreamLink

    Parameters

    property

    The specified stream property.

    Return Value

    The stream link.

  • The complex/entity type metadata for this value (dataType cast to StructureType).

    Declaration

    Swift

    open var structureType: StructureType
  • Unset the value of a specified property, so that hasDataValue(property) will return false.

    Declaration

    Swift

    open func unsetDataValue(for property: Property) -> Void

    Parameters

    property

    The specified property.