EnumType
open class EnumType : DataType
Encapsulates the metadata of an OData enum type.
-
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
-
Represents an undefined enum type.
Declaration
Swift
public static let undefined: EnumType
-
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
-
Source line number for this schema element within its defining schema.
Declaration
Swift
final public var sourceLine: Int
-
True if this type was added since metadata was originally loaded.
Declaration
Swift
final public var isExtension: Bool
-
true
if this simple type was inferred due to a missing term definition in the CSDL.Declaration
Swift
final public var isInferred: Bool
-
Does this enum type represent a set of bit flags?
Declaration
Swift
final public var isFlags: 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 members.Declaration
Swift
final public var isOpenType: Bool
-
If
isOpenType
is true, then the corresponding simple type (with Validation.AllowedValues annotation). Otherwisenil
.Declaration
Swift
final public var simpleType: SimpleType?
-
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 }
-
DataType.ENUM_VALUE
.Declaration
Swift
override open var code: Int { get }
-
Create a new member, optionally generating a unique numeric value for it.
Declaration
Swift
open func createMember(name: String, numberValue: Int64? = nil, stringValue: String? = nil) -> EnumValue
Parameters
name
Member name.
numberValue
Member number value for number-typed enums (if
nil
, a unique member value will be automatically assigned, or zero if too many member values have already been assigned).stringValue
Member string value for string-typed enums (if
nil
, thenname
will be used as the string value).Return Value
New member.
-
Delete an existing member, if one exists with the specified
name
.Declaration
Swift
open func deleteMember(name: String)
Parameters
name
Member name.
-
Synonym for
baseType
.Declaration
Swift
open var derivedFrom: DataType { get set }
-
Declaration
Swift
open func dynamicList(source: ListBase) -> DataValueList
Parameters
source
a list containing
ByteValue
,ShortValue
,IntValue
,LongValue
,UnsignedByte
orUnsignedShort
items (or nulls).Return Value
A list containing
EnumValue
instances corresponding to the numbers insource
. -
Lookup a member by name.
Declaration
Swift
open func findMember(name: String) -> EnumValue?
Parameters
name
Name of the member, or numeric value.
Return Value
The member value, or
nil
if not found. -
true
if this type is a derived simple, complex, entity or enum type.Declaration
Swift
override open var isDerived: Bool { get }
-
Lookup a member by name.
Throws
UndefinedException
if no member is found with this name.Declaration
Swift
open func member(name: String) -> EnumValue
Parameters
name
Name of the member, or numeric value.
Return Value
The member value.
-
List of members for this type.
Declaration
Swift
public final var memberList: EnumValueList { get set }
-
Map of members for this type.
Declaration
Swift
public final var memberMap: EnumValueMap { get set }
-
Synonym for
qualifiedName
.Declaration
Swift
override open var name: String { get }
-
Create a new open enum type, based on an existing simple type. An example simple type would be an OData TypeDefinition using Core.SymbolicName and Validation.AllowedValue to define member names and values.
Declaration
Swift
open class func openSimple(type: SimpleType, terms: AnnotationTermMap) -> EnumType
Parameters
type
Simple type.
terms
Annotation terms from parsed metadata document (
CsdlDocument.annotationTerms
).Return Value
New enum type.
-
Create or update a simple type, based on the current open enum type. An example simple type would be an OData TypeDefinition using Core.SymbolicName and Validation.AllowedValue to define member names and values.
Declaration
Swift
open func toSimpleType(terms: AnnotationTermMap, update: SimpleType? = nil) -> SimpleType
Parameters
terms
Annotation terms from parsed metadata document (
CsdlDocument.annotationTerms
).update
Existing simple type to be updated. If not specified, a new simple type will be created.
Return Value
Created or updated simple type.
-
Declaration
Swift
override open func toString() -> String
Return Value
The name of this data type.
-
Declaration
Swift
open func withByte(_ value: Int) -> EnumValue
Parameters
value
Numeric enum value.
Return Value
A value of this enum type with the specified value.
-
Declaration
Swift
open func withInt(_ value: Int) -> EnumValue
Parameters
value
Numeric enum value.
Return Value
A value of this enum type with the specified value.
-
Declaration
Swift
open func withLong(_ value: Int64) -> EnumValue
Parameters
value
Numeric enum value.
Return Value
A value of this enum type with the specified value.
-
Declaration
Swift
open func withOptionalByte(_ value: Int?) -> EnumValue?
Parameters
value
Numeric enum value.
Return Value
A value of this enum type with the specified value.
-
Declaration
Swift
open func withOptionalInt(_ value: Int?) -> EnumValue?
Parameters
value
Numeric enum value.
Return Value
A value of this enum type with the specified value.
-
Declaration
Swift
open func withOptionalLong(_ value: Int64?) -> EnumValue?
Parameters
value
Numeric enum value.
Return Value
A value of this enum type with the specified value.
-
Declaration
Swift
open func withOptionalShort(_ value: Int?) -> EnumValue?
Parameters
value
Numeric enum value.
Return Value
A value of this enum type with the specified value.
-
Declaration
Swift
open func withShort(_ value: Int) -> EnumValue
Parameters
value
Numeric enum value.
Return Value
A value of this enum type with the specified value.
-
Declaration
Swift
open func withUnsignedByte(_ value: UnsignedByte?) -> EnumValue?
Parameters
value
Numeric enum value.
Return Value
A value of this enum type with the specified value.
-
Declaration
Swift
open func withUnsignedShort(_ value: UnsignedShort?) -> EnumValue?
Parameters
value
Numeric enum value.
Return Value
A value of this enum type with the specified value.