pt.digitalis.utils.ioc.modules
Class IoCBinding

java.lang.Object
  extended by pt.digitalis.utils.ioc.modules.IoCBinding
All Implemented Interfaces:
IIoCBinding

public class IoCBinding
extends Object
implements IIoCBinding

Defines a IoC binding. Uses the 'Fluent Interface' idiom for subsequent method invocations context relaying. The setter methods update the binding on the binder.

Author:
Pedro Viegas pviegas@digitalis.pt, Rodrigo Gonçalves rgoncalves@digitalis.pt

Constructor Summary
IoCBinding(Class<?> interfaceType, Class<?> implementationType, boolean isFinal, boolean override, boolean isSingleton, String id, IoCBinder binder)
          Constructs a new IoCBinding object.
IoCBinding(Class<?> interfaceType, Class<?> implementationType, IoCBinder binder)
          Constructs a new IoCBinding object.
 
Method Summary
 IIoCBinding asFinal()
          Returns the current binding as final.
 IIoCBinding asSingleton()
          Returns the current binding as singleton.
protected  void deleteBinderReference()
          Deletes the reference to the binder.
 String getId()
          Inspector for the 'id' property.
 Class<?> getImplementationType()
          Inspector for the implementation type property.
 Class<?> getInterfaceType()
          Inspector for the interface type property.
 boolean isFinal()
          Inspector for the 'final' property.
 boolean isMultiple()
           
 boolean isOverride()
          Inspector for the 'override' attribute.
 boolean isSingleton()
          Inspector for the 'singleton' property.
 IIoCBinding override()
          Returns the current binding as overriding a previous bind to the same interface.
 String toString()
           
 IIoCBinding withId(String id)
          Returns the current binding with the given id.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IoCBinding

public IoCBinding(Class<?> interfaceType,
                  Class<?> implementationType,
                  boolean isFinal,
                  boolean override,
                  boolean isSingleton,
                  String id,
                  IoCBinder binder)
Constructs a new IoCBinding object.

Parameters:
interfaceType - the interface type
implementationType - implementation type
isFinal - 'final' flag
override - 'override' flag
isSingleton - 'singleton' flag
id - the binding id
binder - the IoC binder associated to this binding

IoCBinding

public IoCBinding(Class<?> interfaceType,
                  Class<?> implementationType,
                  IoCBinder binder)
Constructs a new IoCBinding object. The binding is defined as non-final and non-singleton.

Parameters:
interfaceType - the interface type
implementationType - the implementation type
binder - the IoC binder associated to this binding
Method Detail

asFinal

public IIoCBinding asFinal()
Description copied from interface: IIoCBinding
Returns the current binding as final.

Specified by:
asFinal in interface IIoCBinding
Returns:
the updated binding object
See Also:
IIoCBinding.asFinal()

asSingleton

public IIoCBinding asSingleton()
Description copied from interface: IIoCBinding
Returns the current binding as singleton.

Specified by:
asSingleton in interface IIoCBinding
Returns:
the updated binding object
See Also:
IIoCBinding.asSingleton()

deleteBinderReference

protected void deleteBinderReference()
Deletes the reference to the binder.


getId

public String getId()
Inspector for the 'id' property.

Returns:
the id

getImplementationType

public Class<?> getImplementationType()
Inspector for the implementation type property.

Returns:
the implementation type

getInterfaceType

public Class<?> getInterfaceType()
Inspector for the interface type property.

Returns:
the interface type

isFinal

public boolean isFinal()
Inspector for the 'final' property.

Returns:
the isFinal

isMultiple

public boolean isMultiple()
Returns:
T if the current module is a multiple binding (it it has ID defined)

isOverride

public boolean isOverride()
Inspector for the 'override' attribute.

Returns:
the override value

isSingleton

public boolean isSingleton()
Inspector for the 'singleton' property.

Returns:
the isSingleton

override

public IIoCBinding override()
Description copied from interface: IIoCBinding
Returns the current binding as overriding a previous bind to the same interface.

Specified by:
override in interface IIoCBinding
Returns:
the updated binding object
See Also:
IIoCBinding.override()

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

withId

public IIoCBinding withId(String id)
Description copied from interface: IIoCBinding
Returns the current binding with the given id.

Specified by:
withId in interface IIoCBinding
Parameters:
id - the binding's id
Returns:
the updated binding object
See Also:
IIoCBinding.withId(java.lang.String)


Copyright © 2012 Digitalis Informática Lda. All Rights Reserved.