StructureType
open class StructureType : DataType
Common base class for ComplexType
and EntityType
.
-
Can this model element be removed by
DataService.refreshMetadata
. Defaults tofalse
. Set this totrue
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
-
Is this type for client-only use in an offline scenario?
Declaration
Swift
final public var isClientOnly: Bool
-
true
if this is an open type. An open type can have dynamic properties.Declaration
Swift
final public var isOpenType: Bool
-
Was this structure type synthesized to support service implementation?
Declaration
Swift
final public var isSynthesized: Bool
-
Source line number for this schema element within its defining schema.
Declaration
Swift
final public var sourceLine: Int
-
Array of stream, structural and navigation properties for this type. Performance-critical code may wish to use this instead of
propertyList
.Declaration
Swift
final public var propertyArray: PropertyArray
-
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
-
Map of stream, structural and navigation properties for this type. Might differ from
propertyMap
for OpenAPI compatibility (e.g. when property names being OData compliant might not match JSON field names for request/response payload).Declaration
Swift
final public var jsonFieldMap: PropertyMap
-
List of stream properties for this type.
Declaration
Swift
final public var streamProperties: PropertyList
-
List of entity properties for this type (a subset of
navigationProperties
).Declaration
Swift
final public var entityProperties: PropertyList
-
List of complex properties for this type (a subset of
structuralProperties
).Declaration
Swift
final public var complexProperties: PropertyList
-
List of collection-typed properties for this type (both structural and navigation properties may be included).
Declaration
Swift
final public var collectionProperties: PropertyList
-
List of persistent properties for this type. This is a combination of
structuralProperties
with anykeyProperties
for whichProperty.hasKeyPath
is true and theProperty.keyPath
includes navigation properties.Declaration
Swift
final public var persistentProperties: PropertyList
-
List of structural properties for this type.
See also
Property.isStructural
.Declaration
Swift
final public var structuralProperties: PropertyList
-
List of navigation properties for this type.
See also
Property.isNavigation
.Declaration
Swift
final public var navigationProperties: PropertyList
-
List of extension properties for this type. Includes extension structural/navigation properties.
See also
Property.isExtension
.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.
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 }
-
true
if this type has subtypes.Declaration
Swift
@inline(__always) open var hasSubtypes: Bool { get }
-
true
if this type has a supertype.Declaration
Swift
@inline(__always) 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 }
-
Lookup an existing property by name. Panic if the property does not exist.
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 { // The property BirthDate does not exists, add logic to handle the issue/throw an Exception, etc.. } }
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 requested property.