CBLFragment

@protocol CBLFragment <NSObject>

CBLFragment protocol provides read access to the data value wrapped by a fragment object.

  • Gets the value as an object. The object types are CBLBlob, CBLArray, CBLDictionary, NSNumber, or NSString based on the underlying data type; or nil if the value is nil.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSObject *value;
  • Gets the value as a string. Returns nil if the value is nil, or the value is not a string.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSString *string;
  • Gets the value as a number. Returns nil if the value is nil, or the value is not a number.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSNumber *number;
  • Gets the value as an integer. Floating point values will be rounded. The value true is returned as 1, false as 0. Returns 0 if the value is nil or is not a numeric value.

    Declaration

    Objective-C

    @property (nonatomic, readonly) NSInteger integerValue;
  • Gets the value as a long long. Floating point values will be rounded. The value true is returned as 1, false as 0. Returns 0 if the value is nil or is not a numeric value.

    Declaration

    Objective-C

    @property (nonatomic, readonly) long long longLongValue;
  • Gets the value as a float. Integers will be converted to float. The value true is returned as 1.0, false as 0.0. Returns 0.0 if the value is nil or is not a numeric value.

    Declaration

    Objective-C

    @property (nonatomic, readonly) float floatValue;
  • Gets the value as a double. Integers will be converted to double. The value true is returned as 1.0, false as 0.0. Returns 0.0 if the value is nil or is not a numeric value.

    Declaration

    Objective-C

    @property (nonatomic, readonly) double doubleValue;
  • Gets the value as a boolean. Returns YES if the value is not nil nor NSNull, and is either true or a nonzero number.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL booleanValue;
  • Gets the value as an NSDate. JSON does not directly support dates, so the actual property value must be a string, which is then parsed according to the ISO-8601 date format (the default used in JSON.) Returns nil if the value is nil, is not a string, or is not parseable as a date. NOTE: This is not a generic date parser! It only recognizes the ISO-8601 format, with or without milliseconds.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) NSDate *date;
  • Get the value as a CBLBlob. Returns nil if the value is nil, or the value is not a CBLBlob.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) CBLBlob *blob;
  • Get the value as a CBLArray, a mapping object of an array value. Returns nil if the value is nil, or the value is not an array.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) CBLArray *array;
  • Get a property’s value as a CBLDictionary, a mapping object of a dictionary value. Returns nil if the value is nil, or the value is not a dictionary.

    Declaration

    Objective-C

    @property (nonatomic, readonly, nullable) CBLDictionary *dictionary;
  • Checks whether the value held by the fragment object exists or is nil value or not.

    Declaration

    Objective-C

    @property (nonatomic, readonly) BOOL exists;