EMEmvOptional

Objective-C


@interface EMEmvOptional<__covariant ObjectType> : NSObject

Swift

class EMEmvOptional<ObjectType> : NSObject where ObjectType : AnyObject

EMEmvOptional.

Since

5.0
  • Constructs an instance with the described value.

    Since

    5.0

    Declaration

    Objective-C

    + (instancetype)optional;
  • Returns an EMEmvOptional describing the given value, if non-null, otherwise returns an empty EMEmvOptional.

    Declaration

    Objective-C

    + (instancetype)optionalOf:(ObjectType)aValue;

    Swift

    convenience init!(of aValue: ObjectType!)

    Parameters

    aValue

    the possibly-null value to describe

    Return Value

    an EMEmvOptional with a present value if the specified value is non-null, otherwise an empty EMEmvOptional

  • Returns an EMEmvOptional describing the given value, if non-null, otherwise returns an empty EMEmvOptional.

    Declaration

    Objective-C

    + (instancetype)optionalOfNullable:(ObjectType)aValue;

    Swift

    convenience init!(ofNullable aValue: ObjectType!)

    Parameters

    aValue

    the possibly-null value to describe

    Return Value

    an EMEmvOptional with a present value if the specified value is non-null, otherwise an empty EMEmvOptional

  • Returns the value if present, otherwise throws NSInternalInconsistencyException.

    See

    EMEmvOptional#isPresent()

    Declaration

    Objective-C

    - (ObjectType)get;

    Swift

    func get() -> ObjectType!

    Return Value

    the non-null value described by this EMEmvOptional @throws NSInternalInconsistencyException if no value is present

  • Returns YES if present, otherwise NO.

    Declaration

    Objective-C

    - (BOOL)isPresent;

    Swift

    func isPresent() -> Bool
  • Returns the value if present, otherwise returns ObjectType.

    Declaration

    Objective-C

    - (ObjectType)orElse:(ObjectType)anOther;

    Swift

    func orElse(_ anOther: ObjectType!) -> ObjectType!

    Parameters

    anOther

    the value to be returned, if no value is present. May be null.

    Return Value

    the value, if present, otherwise ObjectType