StrangeIoC  0.6.0
The IoC/Binding Framework for Unity3D and C#
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
strange.framework.impl.Binder Class Reference

Collection class for bindings. More...

Inheritance diagram for strange.framework.impl.Binder:
strange.framework.api.IBinder strange.extensions.command.impl.CommandBinder strange.extensions.context.impl.Context strange.extensions.context.impl.CrossContextBridge strange.extensions.dispatcher.eventdispatcher.impl.EventDispatcher strange.extensions.injector.impl.InjectionBinder strange.extensions.mediation.impl.MediationBinder strange.extensions.reflector.impl.ReflectionBinder strange.extensions.command.impl.EventCommandBinder strange.extensions.command.impl.SignalCommandBinder strange.extensions.sequencer.impl.Sequencer strange.extensions.context.impl.CrossContext strange.extensions.injector.impl.CrossContextInjectionBinder strange.extensions.sequencer.impl.EventSequencer strange.extensions.context.impl.MVCSContext

Public Member Functions

delegate void BindingResolver (IBinding binding)
 A handler for resolving the nature of a binding during chained commands.
 
virtual IBinding Bind< T > ()
 Bind a Binding Key to a class or interface generic.
 
virtual IBinding Bind (object key)
 Bind a Binding Key to a value.
 
virtual IBinding GetBinding< T > ()
 Retrieve a binding based on the provided Type.
 
virtual IBinding GetBinding (object key)
 Retrieve a binding based on the provided object.
 
virtual IBinding GetBinding< T > (object name)
 Retrieve a binding based on the provided Key (generic)/Name combo.
 
virtual IBinding GetBinding (object key, object name)
 Retrieve a binding based on the provided Key/Name combo.
 
virtual void Unbind< T > ()
 Remove a binding based on the provided Key (generic)
 
virtual void Unbind (object key)
 Remove a binding based on the provided Key.
 
virtual void Unbind< T > (object name)
 Remove a binding based on the provided Key (generic) / Name combo.
 
virtual void Unbind (object key, object name)
 Remove a binding based on the provided Key / Name combo.
 
virtual void Unbind (IBinding binding)
 Remove the provided binding from the Binder.
 
virtual void RemoveValue (IBinding binding, object value)
 Remove a select value from the given binding.
 
virtual void RemoveKey (IBinding binding, object key)
 Remove a select key from the given binding.
 
virtual void RemoveName (IBinding binding, object name)
 Remove a select name from the given binding.
 
virtual IBinding GetRawBinding ()
 Generate an unpopulated IBinding in whatever concrete form the Binder dictates.
 
virtual void ResolveBinding (IBinding binding, object key)
 This method places individual Bindings into the bindings Dictionary as part of the resolving process. More...
 
virtual void OnRemove ()
 The Binder is being removed Override this method to clean up remaining bindings.
 

Protected Member Functions

virtual void resolver (IBinding binding)
 The default handler for resolving bindings during chained commands.
 
void registerNameConflict (object key, IBinding newBinding, IBinding existingBinding)
 Take note of bindings that are in conflict. More...
 
bool isConflictCleared (Dictionary< IBinding, object > dict, IBinding binding)
 Returns true if the provided binding and the binding in the dict are no longer conflicting.
 
void clearConflict (object key, object name, Dictionary< IBinding, object > dict)
 
T[] spliceValueAt< T > (int splicePos, object[] objectValue)
 
object[] spliceValueAt (int splicePos, object[] objectValue)
 Remove the item at splicePos from the list objectValue.
 

Protected Attributes

Dictionary< object, Dictionary
< object, IBinding > > 
bindings
 Dictionary of all bindings Two-layer keys. More...
 
Dictionary< object, Dictionary
< IBinding, object > > 
conflicts
 

Detailed Description

Collection class for bindings.

Binders are a collection class (akin to ArrayList and Dictionary) with the specific purpose of connecting lists of things that are not necessarily related, but need some type of runtime association. Binders are the core concept of the StrangeIoC framework, allowing all the other functionality to exist and further functionality to easily be created.

Think of each Binder as a collection of causes and effects, or actions and reactions. If the Key action happens, it triggers the Value action. So, for example, an Event may be the Key that triggers instantiation of a particular class.

Member Function Documentation

void strange.framework.impl.Binder.registerNameConflict ( object  key,
IBinding  newBinding,
IBinding  existingBinding 
)
inlineprotected

Take note of bindings that are in conflict.

This occurs routinely during fluent binding, but will spark an error if GetBinding is called while this Binder still has conflicts.

virtual void strange.framework.impl.Binder.ResolveBinding ( IBinding  binding,
object  key 
)
inlinevirtual

This method places individual Bindings into the bindings Dictionary as part of the resolving process.

Note that while some Bindings may store multiple keys, each key takes a unique position in the bindings Dictionary.

Conflicts in the course of fluent binding are expected, but GetBinding will throw an error if there are any unresolved conflicts.

Implements strange.framework.api.IBinder.

Reimplemented in strange.extensions.injector.impl.CrossContextInjectionBinder, and strange.extensions.command.impl.SignalCommandBinder.

Member Data Documentation

Dictionary<object, Dictionary<object, IBinding> > strange.framework.impl.Binder.bindings
protected

Dictionary of all bindings Two-layer keys.

First key to individual Binding keys, then to Binding names. (This wouldn't be required if Unity supported Tuple or HashSet.)


The documentation for this class was generated from the following file: