C# Class clojure.lang.ARef

Provides basic implementation for the IRef interface methods.
Inheritance: clojure.lang.AReference, IRef
显示文件 Open project: arohner/clojure-contrib

Protected Properties

Property Type Description
_validator IFn

Public Methods

Method Description
ARef ( ) : System

Initializes an ARef with null metadata.

ARef ( IPersistentMap meta ) : System

Initializes an ARef with the given metadata.

deref ( ) : object

Gets the (immutable) value the reference is holding.

getValidator ( ) : IFn

Gets the validator.

getWatches ( ) : IPersistentMap

Gets a map of watchers (key=Agent, value=IFn).

notifyWatches ( ) : void

Notify all watchers.

setValidator ( IFn vf ) : void

Sets the validator.

The current value must validate in order for this validator to be accepted. If not, an exception will be thrown.

Protected Methods

Method Description
Validate ( IFn vf, object val ) : void

Invoke an IFn on a value to validate it.

Uneventful return marks a successful validation. To indicate a failed validation, the validation function should return false or throw an exception.

This appears in multiple places. Should find it a common home?

Validate ( object val ) : void

Call the reference's validator on the given value.

Private Methods

Method Description
addWatch ( Agent watcher, IFn action, bool sendOff ) : IRef
removeWatch ( Agent watcher ) : IRef

Method Details

ARef() public method

Initializes an ARef with null metadata.
public ARef ( ) : System
return System

ARef() public method

Initializes an ARef with the given metadata.
public ARef ( IPersistentMap meta ) : System
meta IPersistentMap The metadata to use
return System

Validate() protected static method

Invoke an IFn on a value to validate it.
Uneventful return marks a successful validation. To indicate a failed validation, the validation function should return false or throw an exception.

This appears in multiple places. Should find it a common home?

protected static Validate ( IFn vf, object val ) : void
vf IFn The IFn to invoke.
val object The value to validate.
return void

Validate() protected method

Call the reference's validator on the given value.
protected Validate ( object val ) : void
val object The value to validate
return void

deref() public abstract method

Gets the (immutable) value the reference is holding.
public abstract deref ( ) : object
return object

getValidator() public method

Gets the validator.
public getValidator ( ) : IFn
return IFn

getWatches() public method

Gets a map of watchers (key=Agent, value=IFn).
public getWatches ( ) : IPersistentMap
return IPersistentMap

notifyWatches() public method

Notify all watchers.
public notifyWatches ( ) : void
return void

setValidator() public method

Sets the validator.
The current value must validate in order for this validator to be accepted. If not, an exception will be thrown.
public setValidator ( IFn vf ) : void
vf IFn The new validtor
return void

Property Details

_validator protected_oe property

The validator for the reference.
protected IFn _validator
return IFn