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
  • 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
  • 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
  • true if this is an open type. An open type can have dynamic properties.

    Declaration

    Swift

    final public var isOpenType: Bool
  • Source line number for this schema element within its defining schema.

    Declaration

    Swift

    final public var sourceLine: Int
  • List of extension properties for this type. Includes extension structural/navigation properties.

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    final public var isInferred: Bool
  • Default initializer.

    Declaration

    Swift

    override public init()
  • Lookup an existing annotation by term name, or throw an exception if the annotation is not found.

    See also

    annotations and AnnotationMap.get, 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 annotation.

  • Obsolete. Use annotations.

    Declaration

    Swift

    open var annotationList: AnnotationList { get }
  • Obsolete. Use annotations.

    Declaration

    Swift

    open var annotationMap: AnnotationMap { get }
  • Map of annotations for this model element. For annotations without qualifiers, the entry key is the annotation term name. For annotations with qualifiers, the entry key is the annotation term name, then “#”, then the annotation qualifier.

    Declaration

    Swift

    open var annotations: AnnotationMap { get }
  • List of collection-typed properties for this type (both structural and navigation properties may be included).

    Declaration

    Swift

    public final var collectionProperties: PropertyList { get set }
  • List of complex properties for this type (a subset of structuralProperties).

    Declaration

    Swift

    public final var complexProperties: PropertyList { get set }
  • true if this type has subtypes.

    Declaration

    Swift

    open var hasSubtypes: Bool { get }
  • true if this type has a supertype.

    Declaration

    Swift

    open var hasSupertype: Bool { get }
  • true if this is an aspect type.

    See also

    CDS.

    Declaration

    Swift

    open var isAspect: Bool { get set }
  • true if this is an event type.

    See also

    CDS.

    Declaration

    Swift

    open var isEvent: Bool { get set }
  • Synonym for qualifiedName.

    Declaration

    Swift

    override open var name: String { get }
  • List of navigation properties for this type.

    Declaration

    Swift

    public final var navigationProperties: PropertyList { get set }
  • List of persistent properties for this type. This is a combination of structuralProperties with any keyProperties for which Property.hasKeyPath is true and the Property.keyPath includes navigation properties.

    Declaration

    Swift

    public final var persistentProperties: PropertyList { get set }
  • 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.

  • List of stream, structural and navigation properties for this type.

    Declaration

    Swift

    public final var propertyList: PropertyList { get set }
  • Map of stream, structural and navigation properties for this type.

    Declaration

    Swift

    public final var propertyMap: PropertyMap { get set }
  • List of stream properties for this type.

    Declaration

    Swift

    public final var streamProperties: PropertyList { get set }
  • List of structural properties for this type.

    Declaration

    Swift

    public final var structuralProperties: PropertyList { get set }