StructureType

open class StructureType: DataType

Common base class for ComplexType and EntityType.

  • Can this model element be removed by DataService.refreshMetadata. Defaults to false. Set this to true to indicate that the application is coded to be able able to function correctly without this model element.

    See also

    isRemoved.

    Declaration

    Swift

    final public var canBeRemoved: Bool = false
  • Has this model element been removed by a successful call to DataService.refreshMetadata? If `isRemoved == true, that implies that the old metadata (before refreshMetadata was called) did include this model element, and that the new metadata (after refreshMetadata was called) does not include this model element.

    See also

    canBeRemoved.

    Declaration

    Swift

    final public var isRemoved: Bool = false
  • The local name of this type within its owning DataSchema, e.g. MyType.

    Declaration

    Swift

    final public var localName: String = ""
  • The name of this type qualified by its owning DataSchema name, e.g. MySchema.MyType.

    Declaration

    Swift

    final public var qualifiedName: String = ""
  • Factory for creating custom (subclass) objects with this type.

    Declaration

    Swift

    final public var objectFactory: ObjectFactory?
  • true if this is an abstract type.

    Declaration

    Swift

    final public var isAbstract: Bool = false
  • true if this is an open type. An open type can have dynamic properties.

    Declaration

    Swift

    final public var isOpenType: Bool = false
  • List of stream, structural and navigation properties for this type.

    Declaration

    Swift

    final public var propertyList: PropertyList!
  • Map of stream, structural and navigation properties for this type.

    Declaration

    Swift

    final public var propertyMap: PropertyMap!
  • List of stream properties for this type.

    Declaration

    Swift

    final public var streamProperties: PropertyList!
  • List of complex properties for this type (a subset of structuralProperties).

    Declaration

    Swift

    final public var complexProperties: PropertyList!
  • List of structural properties for this type.

    Declaration

    Swift

    final public var structuralProperties: PropertyList!
  • List of navigation properties for this type.

    Declaration

    Swift

    final public var navigationProperties: PropertyList!
  • List of extension properties for this type. Includes extension structural/navigation properties.

    Declaration

    Swift

    final public var extensionProperties: PropertyList = PropertyList()
  • true if this type was added since metadata was originally loaded.

    Declaration

    Swift

    final public var isExtension: Bool = false
  • true if this structure type was inferred due to a missing term definition in the CSDL.

    Declaration

    Swift

    final public var isInferred: Bool = false
  • Default initializer.

    Declaration

    Swift

    override public init()
  • Lookup an existing type annotation by term name.

    See also

    annotationMap, for looking up annotations that might not exist.

    Declaration

    Swift

    open func annotation(withName term: String) -> Annotation

    Parameters

    term

    The term name.

    Return Value

    The type annotation.

  • List of annotations for this type.

    Declaration

    Swift

    open var annotationList: AnnotationList
  • Map of annotations for this type.

    Declaration

    Swift

    open var annotationMap: AnnotationMap
  • Synonym for qualifiedName.

    Declaration

    Swift

    override open var name: String
  • Lookup an existing property by name. If the property does not exist it indicates a fundamental implementation problem, therefore a non-catchable FatalException will be thrown, and the app intentionally crashes. The reason behind this drastic behaviour is to avoid mismatch between server and client. It is still possible to avoid the FatalException by looking up propery before calling this method like in the following code snippet:

    Example checking if a property exists

    open func checkPropertyExistsExample() throws -> Void {
        let service = self.service
        let entitySet = service.entitySet(withName: "Employees")
        let entityType = entitySet.entityType
        let propMap = entityType.propertyMap
        if propMap.keys().includes(item: "BirthDate") {
            _ = entityType.property(withName: "BirthDate")
        } else {
        }
    }
    

    See also

    propertyMap, for looking up properties that might not exist.

    Declaration

    Swift

    open func property(withName name: String) -> Property

    Parameters

    name

    Name of the property.

    Return Value

    The property metadata, which MUST exists.