ValidationContext

ValidationContext

Context passed to a ValidateDelegate.

Syntax


@protocol CBLValidationContext
protocol CBLValidationContext
public interface ValidationContext
public interface ValidationContext
public interface IValidationContext

Summary


Properties
String[]
changedKeys { get; }
Gets the keys whose values have changed between the current and new Revisions.
SavedRevision
currentRevision { get; }
Gets the current Revision of the Document, or null if this is a new Document.
Methods
void
reject()
Rejects the new Revision.
void
reject(String message)
Rejects the new Revision. The specified message will be included with the resulting error.
boolean
validateChanges( ValidateChangeDelegate validateChangeDelegate)
Calls the ValidateChangeDelegate for each key/value that has changed, passing both the old and new values. If any delegate call returns false, the enumeration stops and false is returned, otherwise true is returned.
Delegates
boolean
ValidateChangeDelegate(String key, Object oldValue, Object newValue)
A delegate that can validate a key/value change.

Properties


String[] changedKeys { get; }
Gets the keys whose values have changed between the current and new Revisions.

Syntax

@property (readonly) NSArray * changedKeys
var changedKeys: [AnyObject] { get }
public List<String> getChangedKeys()
public List<String> getChangedKeys()
IEnumerable<String> ChangedKeys { get; }
SavedRevision currentRevision { get; }
Gets the current Revision of the Document, or null if this is a new Document.

Syntax

@property (readonly) CBLSavedRevision * currentRevision
var currentRevision(): SavedRevision { get }
public SavedRevision getCurrentRevision()
public SavedRevision getCurrentRevision()
SavedRevision CurrentRevision { get; }

Methods


void reject()
Rejects the new Revision.

Syntax

-(void)reject
func reject()
public void reject()
public void reject()
void Reject()
void reject(String message)
Rejects the new Revision. The specified message will be included with the resulting error.

Parameters

message The message to include with the resulting error.

Syntax

-(void)rejectWithMessage:(NSString *)message
func reject(message: String!)
public void reject(String message)
public void reject(String message)
void Reject(String message)
boolean validateChanges( ValidateChangeDelegate validateChangeDelegate)
Calls the ValidateChangeDelegate for each key/value that has changed, passing both the old and new values. If any delegate call returns false, the enumeration stops and false is returned, otherwise true is returned.

Parameters

validateChangeDelegate The delegate to use to validate each change.

Returns

False if any call to the ValidateChangeDelegate returns false, otherwise true.

Syntax

-(BOOL)validateChanges:(CBLValidationBlock)changeValidator
func validateChanges(enumerator: CBLChangeEnumeratorBlock!) -> Bool
public boolean validateChanges(ChangeValidator changeValidator)
public boolean validateChanges(ChangeValidator changeValidator)
Boolean ValidateChanges(ValidateChangeDelegate changeValidator)

Delegates


boolean ValidateChangeDelegate(String key, Object oldValue, Object newValue)
A delegate that can validate a key/value change.

Parameters

key The key of the value being changed.
oldValue The old value.
newValue The new value.

Syntax

typedef BOOL (^CBLChangeEnumeratorBlock) (NSString* key, id oldValue, id newValue);
typealias CBLChangeEnumeratorBlock = (key: NSString!, oldValue: AnyObject!, newValue: AnyObject!) -> Bool
public interface ChangeValidator {
    boolean validateChange(String key, Object oldValue, Object newValue);
}
public interface ChangeValidator {
    boolean validateChange(String key, Object oldValue, Object newValue);
}
public delegate Boolean ValidateChangeDelegate(String key, Object oldValue, Object newValue);